Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize SeriesGrouper & aggregators.merge #8391

Merged
merged 1 commit into from
Jan 7, 2021

Commits on Dec 21, 2020

  1. Optimize SeriesGrouper & aggregators.merge

    The previous implementation of SeriesGrouper required breaking a metric object apart into its constituents, converting tags and keys into unoptimized maps, only to have it put them back together into another metric object. This resulted in a significant performance overhead. This overhead was further compounded when the number of fields was large.
    
    This change adds a new AddMetric method to SeriesGrouper which preserves the metric object and removes the back-and-forth conversion.
    
    Additionlly the method used for calculating the metric's hash was switched to use maphash, which is optimized for this case.
    
    ----
    
    Benchmarks
    
    Before:
    
        BenchmarkMergeOne-16          106012	     11790 ns/op
        BenchmarkMergeTwo-16           48529	     24819 ns/op
        BenchmarkGroupID-16           780018	      1608 ns/op
    
    After:
    
        BenchmarkMergeOne-16          907093	      1173 ns/op
        BenchmarkMergeTwo-16          508321	      2168 ns/op
        BenchmarkGroupID-16         11217788	      99.4 ns/op
    phemmer committed Dec 21, 2020
    Configuration menu
    Copy the full SHA
    3e1a2a7 View commit details
    Browse the repository at this point in the history