marusama / Semaphore
Licence: mit
Fast resizable golang semaphore primitive
Stars: ✭ 109
Labels
Projects that are alternatives of or similar to Semaphore
Vynchronize
Watch videos with friends online with the new real time video synchronization platform
Stars: ✭ 1,072 (+883.49%)
Mutual labels: synchronization
Sync
Synchronization primitives for PHP based on Amp.
Stars: ✭ 67 (-38.53%)
Mutual labels: synchronization
Sublimate
Sublimate: Ridiculously fast full stack Swift prototyping with Vapor and Sourcery.
Stars: ✭ 57 (-47.71%)
Mutual labels: synchronization
Zaloha.sh
Small and simple directory synchronizer (a BASH script)
Stars: ✭ 63 (-42.2%)
Mutual labels: synchronization
Copycat Action
©️ GitHub Action for copying files to other repositories
Stars: ✭ 48 (-55.96%)
Mutual labels: synchronization
Decsynccc
Android app to sync contacts, calendars and tasks without a server using DecSync
Stars: ✭ 101 (-7.34%)
Mutual labels: synchronization
Syncchanges
Synchronize/Replicate database changes using SQL Server Change Tracking
Stars: ✭ 66 (-39.45%)
Mutual labels: synchronization
Wp Plugin Git Svn Sync
☄️ Zero config synchronizing of Git repository with SVN for publishing WordPress plugins.
Stars: ✭ 81 (-25.69%)
Mutual labels: synchronization
Syncthing Macos
Frugal and native macOS Syncthing application bundle
Stars: ✭ 1,096 (+905.5%)
Mutual labels: synchronization
Ciruela
A peer-to-peer synchronization software for servers in datacenters.
Stars: ✭ 61 (-44.04%)
Mutual labels: synchronization
Poosh
🌎 Publish local files to virtually any remote endpoint (e.g. AWS S3)
Stars: ✭ 55 (-49.54%)
Mutual labels: synchronization
Clitools
🔧 CliTools for Docker, PHP / MySQL development, debugging and synchonization
Stars: ✭ 86 (-21.1%)
Mutual labels: synchronization
Angrdbg
Abstract library to generate angr states from a debugger state
Stars: ✭ 49 (-55.05%)
Mutual labels: synchronization
Bind Query Params
Sync URL Query Params with Angular Form Controls
Stars: ✭ 73 (-33.03%)
Mutual labels: synchronization
Syncthing
Open Source Continuous File Synchronization
Stars: ✭ 41,904 (+38344.04%)
Mutual labels: synchronization
Etebase Js
Etebase TypeScript API for the web, node and react-native!
Stars: ✭ 100 (-8.26%)
Mutual labels: synchronization
Lite
Split a repository to read-only standalone repositories
Stars: ✭ 1,229 (+1027.52%)
Mutual labels: synchronization
semaphore
Fast resizable golang semaphore based on CAS
- allows weighted acquire/release;
- supports cancellation via context;
- allows change semaphore limit after creation;
- faster than channel based semaphores.
Usage
Initiate
import "github.com/marusama/semaphore/v2"
...
sem := semaphore.New(5) // new semaphore with limit = 5
Acquire
sem.Acquire(ctx, n) // acquire n with context
sem.TryAcquire(n) // try acquire n without blocking
...
ctx := context.WithTimeout(context.Background(), time.Second)
sem.Acquire(ctx, n) // acquire n with timeout
Release
sem.Release(n) // release n
Change semaphore limit
sem.SetLimit(new_limit) // set new semaphore limit
Some benchmarks
Run on MacBook Pro (2017) with 3,1GHz Core i5 cpu and 8GB DDR3 ram, macOS High Sierra, go version go1.11.4 darwin/amd64:
// this semaphore:
BenchmarkSemaphore_Acquire_Release_under_limit_simple-4 20000000 98.6 ns/op 96 B/op 1 allocs/op
BenchmarkSemaphore_Acquire_Release_under_limit-4 1000000 1593 ns/op 960 B/op 10 allocs/op
BenchmarkSemaphore_Acquire_Release_over_limit-4 100000 20760 ns/op 9600 B/op 100 allocs/op
// some other implementations:
// golang.org/x/sync/semaphore:
BenchmarkXSyncSemaphore_Acquire_Release_under_limit_simple-4 50000000 34.9 ns/op 0 B/op 0 allocs/op
BenchmarkXSyncSemaphore_Acquire_Release_under_limit-4 1000000 1103 ns/op 0 B/op 0 allocs/op
BenchmarkXSyncSemaphore_Acquire_Release_over_limit-4 30000 65927 ns/op 15985 B/op 299 allocs/op
// github.com/abiosoft/semaphore:
BenchmarkAbiosoftSemaphore_Acquire_Release_under_limit_simple-4 10000000 208 ns/op 0 B/op 0 allocs/op
BenchmarkAbiosoftSemaphore_Acquire_Release_under_limit-4 500000 3147 ns/op 0 B/op 0 allocs/op
BenchmarkAbiosoftSemaphore_Acquire_Release_over_limit-4 50000 37148 ns/op 0 B/op 0 allocs/op
// github.com/dropbox/godropbox
BenchmarkDropboxBoundedSemaphore_Acquire_Release_under_limit_simple-4 20000000 75.9 ns/op 0 B/op 0 allocs/op
BenchmarkDropboxBoundedSemaphore_Acquire_Release_under_limit-4 2000000 629 ns/op 0 B/op 0 allocs/op
BenchmarkDropboxBoundedSemaphore_Acquire_Release_over_limit-4 200000 27308 ns/op 0 B/op 0 allocs/op
BenchmarkDropboxUnboundedSemaphore_Acquire_Release_under_limit_simple-4 50000000 39.7 ns/op 0 B/op 0 allocs/op
BenchmarkDropboxUnboundedSemaphore_Acquire_Release_under_limit-4 1000000 1170 ns/op 0 B/op 0 allocs/op
BenchmarkDropboxUnboundedSemaphore_Acquire_Release_over_limit-4 100000 21013 ns/op 0 B/op 0 allocs/op
// github.com/kamilsk/semaphore
BenchmarkKamilskSemaphore_Acquire_Release_under_limit_simple-4 20000000 110 ns/op 16 B/op 1 allocs/op
BenchmarkKamilskSemaphore_Acquire_Release_under_limit-4 1000000 1520 ns/op 160 B/op 10 allocs/op
BenchmarkKamilskSemaphore_Acquire_Release_over_limit-4 50000 42693 ns/op 1600 B/op 100 allocs/op
// github.com/pivotal-golang/semaphore
BenchmarkPivotalGolangSemaphore_Acquire_Release_under_limit_simple-4 3000000 558 ns/op 136 B/op 2 allocs/op
BenchmarkPivotalGolangSemaphore_Acquire_Release_under_limit-4 200000 9530 ns/op 1280 B/op 20 allocs/op
BenchmarkPivotalGolangSemaphore_Acquire_Release_over_limit-4 10000 111264 ns/op 12801 B/op 200 allocs/op
You can rerun these benchmarks, just checkout benchmarks
branch and run go test -bench=. -benchmem ./bench/...
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].