Skip to content

Improve performance and reduce allocs

Compare
Choose a tag to compare
@charlievieth charlievieth released this 11 Jan 22:51
· 71 commits to master since this release
bade9ed
  • Improve the performance of New* methods and tcpStatsdSink #50
  • Scope: remove fmt.Sprintf() string concatenation and improve tag merge #61

Benchmark Results (7054f86..bade9ed benchmarks backported to 7054f86):

benchmark                               old ns/op     new ns/op     delta
BenchmarkStore_MutexContention-8        251           112           -55.38%
BenchmarkStore_NewCounterWithTags-8     2710          489           -81.96%
BenchmarkStore_ScopeWithTags-8          6041          1389          -77.01%
BenchmarkStore_ScopeNoTags-8            3347          556           -83.39%
BenchmarkSerializeTags-8                2513          456           -81.85%

benchmark                               old allocs     new allocs     delta
BenchmarkStore_MutexContention-8        2              0              -100.00%
BenchmarkStore_NewCounterWithTags-8     32             3              -90.62%
BenchmarkStore_ScopeWithTags-8          61             4              -93.44%
BenchmarkStore_ScopeNoTags-8            37             4              -89.19%
BenchmarkSerializeTags-8                30             3              -90.00%

benchmark                               old bytes     new bytes     delta
BenchmarkStore_MutexContention-8        22            2             -90.91%
BenchmarkStore_NewCounterWithTags-8     800           272           -66.00%
BenchmarkStore_ScopeWithTags-8          1648          544           -66.99%
BenchmarkStore_ScopeNoTags-8            1200          304           -74.67%
BenchmarkSerializeTags-8                768           272           -64.58%