Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danil/oncelockexample
Once lock example for Go.
https://github.com/danil/oncelockexample
atomic channels go golang mutex
Last synced: 13 days ago
JSON representation
Once lock example for Go.
- Host: GitHub
- URL: https://github.com/danil/oncelockexample
- Owner: danil
- License: bsd-3-clause
- Created: 2022-07-10T12:41:53.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-17T16:56:25.000Z (over 2 years ago)
- Last Synced: 2024-06-21T11:46:41.603Z (7 months ago)
- Topics: atomic, channels, go, golang, mutex
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Once lock example for Go
[![Build Status](https://cloud.drone.io/api/badges/danil/oncelockexample/status.svg)](https://cloud.drone.io/danil/oncelockexample)
[![Go Reference](https://pkg.go.dev/badge/github.com/danil/oncelockexample.svg)](https://pkg.go.dev/github.com/danil/oncelockexample)Source files are distributed under the BSD-style license.
## About
The software is considered to be at a alpha level of readiness,
its extremely slow and allocates a lots of memory.## Benchmark
```sh
$ go test -count=1 -race -bench ./...
goos: linux
goarch: amd64
pkg: github.com/danil/oncelockexample
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
BenchmarkAtomic/atomic-8 13257363 84.48 ns/op
BenchmarkUberAtomic/uber_atomic-8 10779932 111.4 ns/op
BenchmarkMutex/mutex-8 4926771 244.5 ns/op
BenchmarkRWMutex/read-write_mutex-8 5244938 230.2 ns/op
BenchmarkChannel/channel-8 9048637 125.2 ns/op
PASS
ok github.com/danil/oncelockexample 6.723s
```