All Projects → tevino → Abool

tevino / Abool

Licence: mit
💡 Atomic Boolean library for cleaner Go code, optimized for performance yet simple to use.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Abool

Java Concurrency Examples
Java Concurrency/Multithreading Tutorial with Examples for Dummies
Stars: ✭ 173 (-23.11%)
Mutual labels:  synchronization
Backbone Redux
Easy way to keep your backbone collections and redux store in sync.
Stars: ✭ 185 (-17.78%)
Mutual labels:  synchronization
Ansible Role Ntp
Ansible Role - NTP
Stars: ✭ 203 (-9.78%)
Mutual labels:  synchronization
Etesync Dav
This is a CalDAV and CardDAV adapter for EteSync
Stars: ✭ 176 (-21.78%)
Mutual labels:  synchronization
Pywarm
A cleaner way to build neural networks for PyTorch.
Stars: ✭ 184 (-18.22%)
Mutual labels:  clean-code
Llvs
Low-Level Versioned Store
Stars: ✭ 193 (-14.22%)
Mutual labels:  synchronization
K8s Wait For
A simple script that allows to wait for a k8s service, job or pods to enter a desired state
Stars: ✭ 172 (-23.56%)
Mutual labels:  synchronization
Code Review Checklist
This code review checklist helps you be a more effective and efficient code reviewer.
Stars: ✭ 214 (-4.89%)
Mutual labels:  clean-code
Android
EteSync - Secure, end-to-end encrypted, and privacy respecting sync for your contacts, calendars and tasks.
Stars: ✭ 184 (-18.22%)
Mutual labels:  synchronization
Pevents
Implementation of Win32 events for *nix platforms, built on top of pthreads.
Stars: ✭ 200 (-11.11%)
Mutual labels:  synchronization
Remotestorage.js
⬡ JavaScript client library for integrating remoteStorage in apps
Stars: ✭ 2,155 (+857.78%)
Mutual labels:  synchronization
Grav Plugin Git Sync
Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Stars: ✭ 183 (-18.67%)
Mutual labels:  synchronization
Holy Grail Markup
All CSS methodologies compared examples at one place.
Stars: ✭ 197 (-12.44%)
Mutual labels:  atomic
Multiotp
multiOTP open source strong two factor authentication PHP library, OATH certified, with TOTP, HOTP, Mobile-OTP, YubiKey, SMS, QRcode provisioning, etc.
Stars: ✭ 173 (-23.11%)
Mutual labels:  synchronization
Concurrent
Functional Concurrency Primitives
Stars: ✭ 206 (-8.44%)
Mutual labels:  synchronization
Kross Hugo
Kross Creative Portfolio Template
Stars: ✭ 172 (-23.56%)
Mutual labels:  clean-code
Clean Code Javascript
🛁 Адаптированные для JavaScript концепции Чистого кода
Stars: ✭ 187 (-16.89%)
Mutual labels:  clean-code
Linqit
Extend python lists with .NET's LINQ syntax for clean and fast coding. Also known as PINQ.
Stars: ✭ 222 (-1.33%)
Mutual labels:  clean-code
Bookmarks
🔖 +4.3K awesome resources for geeks and software crafters 🍺
Stars: ✭ 210 (-6.67%)
Mutual labels:  clean-code
Ex check
One task to efficiently run all code analysis & testing tools in an Elixir project. Born out of 💜 to Elixir and pragmatism.
Stars: ✭ 198 (-12%)
Mutual labels:  clean-code

ABool 💡

Go Report Card GoDoc

Atomic Boolean package for Go, optimized for performance yet simple to use.

Designed for cleaner code.

Usage

import "github.com/tevino/abool"

cond := abool.New()     // default to false

cond.Set()              // Sets to true
cond.IsSet()            // Returns true
cond.UnSet()            // Sets to false
cond.IsNotSet()         // Returns true
cond.SetTo(any)         // Sets to whatever you want
cond.SetToIf(new, old)  // Sets to `new` only if the Boolean matches the `old`, returns whether succeeded
cond.Toggle()           // Inverts the boolean then returns the value before inverting


// embedding
type Foo struct {
    cond *abool.AtomicBool  // always use pointer to avoid copy
}

Benchmark

  • Go 1.14.3
  • Linux 4.19.0
goos: linux
goarch: amd64

# Read
BenchmarkMutexRead-4          	86662128	        14.2 ns/op
BenchmarkAtomicValueRead-4    	1000000000	         0.755 ns/op
BenchmarkAtomicBoolRead-4     	1000000000	         0.720 ns/op  # <--- This package


# Write
BenchmarkMutexWrite-4         	76237544	        13.6 ns/op
BenchmarkAtomicValueWrite-4   	79471124	        14.9 ns/op
BenchmarkAtomicBoolWrite-4    	178218270	         6.73 ns/op  # <--- This package

# CAS
BenchmarkMutexCAS-4           	29416574	        34.7 ns/op
BenchmarkAtomicBoolCAS-4      	171900002	         7.14 ns/op  # <--- This package

# Toggle
BenchmarkMutexToggle-4        	35212117	        34.5 ns/op
BenchmarkAtomicBoolToggle-4   	169871972	         7.02 ns/op  # <--- This package

Special thanks to contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].