go-metrics
go-metrics copied to clipboard
Defer
trafficstars
Hi have you seen this: http://lk4d4.darth.io/posts/defer/ ?
I benchmarked it again against go 1.3.1 and I still see a quite big difference
BenchmarkPut 50000 38259 ns/op
BenchmarkPutDefer 50000 63552 ns/op
BenchmarkGet 50000 41260 ns/op
BenchmarkGetDefer 10000 107873 ns/op
Basically defer seems not yet fully optimized.
Since go-metrics have different short functions with defer probably removing them could help in measuring with more precision.
What do you think?
Very reasonable. I'll work on that.
Discussed recently with a friend how much of a difference it would be if the Mutexes were replaced with channels for the same thread safety. This would also get rid of the defer
I'll put some benchmarks together and an eventual PR if it proves to be better