2016-05-25 14:56:18 -05:00
|
|
|
# flake
|
|
|
|
Very simple snowflake generator
|
|
|
|
|
2016-05-25 16:28:44 -05:00
|
|
|
Finally, hit my goal of 244ns/op.
|
|
|
|
|
|
|
|
But, interesting comparison of different methods.
|
2016-05-25 15:07:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
```
|
2016-05-25 16:28:44 -05:00
|
|
|
time go test -bench=.
|
2016-05-25 15:07:49 -05:00
|
|
|
testing: warning: no tests to run
|
|
|
|
PASS
|
2016-05-25 16:28:44 -05:00
|
|
|
BenchmarkGenerateChan-12 3000000 503 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateChanParallel-12 2000000 743 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateNoSleep-12 5000000 244 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateNoSleepLock-12 5000000 283 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateNoSleepLockParallel-12 5000000 348 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerate-12 5000000 283 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateLocks-12 5000000 293 ns/op 0 B/op 0 allocs/op
|
|
|
|
BenchmarkGenerateLocksParallel-12 5000000 368 ns/op 0 B/op 0 allocs/op
|
|
|
|
ok _/home/bruce/flake 15.291s
|
|
|
|
go test -bench=. 16.88s user 7.37s system 151% cpu 15.981 total
|
2016-05-25 15:07:49 -05:00
|
|
|
```
|