A performant Atomic Counter for Concurrent Write-More-Read-Less Scenario in Golang

Similar to LongAdder in Java, or ThreadCachedInt in folly, In scenarios of high concurrent writes but few reads, it can provide dozens of times the write performance than sync/atomic. Golang Benchmark per 100 calls. Under Linux: goos: linux goarch: amd64 pkg: github.com/chen3feng/atomiccounter cpu: Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz BenchmarkNonAtomicAdd-16 9508723 135.3 ns/op BenchmarkAtomicAdd-16 582798 2070 ns/op BenchmarkCounter-16 4748263 263.1 […]