LeeCampbell / HdrHistogram.NET

Port of the HdrHistorgram to .NET/C#
Other
18 stars 3 forks source link

Optimised GetBucketIndex -made static and inline candidate #26

Closed LeeCampbell closed 8 years ago

LeeCampbell commented 8 years ago

This simple change allowed the hot path (as identified by dotTrace) to be in-lined and then do the work in private static methods. In local dev testing this gave a ~10% perf improvement

Prior results:

Label,Messages,TotalSeconds,Gen0Collections,Gen1Collections,Gen2Collections,TotalBytesAllocated
IntHistogram,1000000000,3.6882575,0,0,0,0
LongHistogram,1000000000,3.7504962,0,0,0,0
ShortHistogram,1000000000,3.6163528,0,0,0,0
SynchronizedHistogram,1000000000,9.4640547,0,0,0,0

After results

Label,Messages,TotalSeconds,Gen0Collections,Gen1Collections,Gen2Collections,TotalBytesAllocated
IntHistogram,1000000000,3.1881527,0,0,0,0
LongHistogram,1000000000,3.2705532,0,0,0,0
ShortHistogram,1000000000,3.1813548,0,0,0,0
SynchronizedHistogram,1000000000,9.1409902,0,0,0,0

thus LongHistogram goes from 3.7504962sec to 3.2705532sec i.e. a 0.479943sec (12.79%) improvement