Descriptionsync: add fast path to Once
The implementation does not grab the lock,
if Once is already initalized.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark old ns/op new ns/op delta
sync_test.BenchmarkOnce 187.00 14.00 -92.51%
sync_test.BenchmarkOnce-2 909.00 21.40 -97.65%
sync_test.BenchmarkOnce-4 3684.00 20.90 -99.43%
sync_test.BenchmarkOnce-8 5987.00 23.00 -99.62%
sync_test.BenchmarkOnce-16 5051.00 21.60 -99.57%
Patch Set 1 #Patch Set 2 : diff -r 6f1145ee588d https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 6f1145ee588d https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 9e53a1312e25 https://go.googlecode.com/hg/ #
Total comments: 1
Patch Set 5 : diff -r 9e53a1312e25 https://go.googlecode.com/hg/ #MessagesTotal messages: 14
|