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

Remove boxed primitives from aggregations #5184

Merged
merged 1 commit into from
Feb 12, 2023

Conversation

jack-berg
Copy link
Member

In #5178 I noticed allocations for boxing / unboxing primitives in the exponential and explicit bucket histogram aggregations. This removes those for modest performance improvement.

Before:

Benchmark                                                                            (aggregationGenerator)  (aggregationTemporality)  Mode  Cnt           Score           Error   Units
HistogramCollectBenchmark.recordAndCollect                                        EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5  3390255558.400 ±  29491981.021   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate                         EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           3.007 ±         0.020  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm                    EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5    10689731.200 ±     36579.743    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                              EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                               EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           2.000                      ms
HistogramCollectBenchmark.recordAndCollect                                        EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  3436534566.600 ± 102736943.608   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate                         EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.202 ±         0.199  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm                    EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5    11536620.800 ±    526953.810    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                              EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                               EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.000                      ms
HistogramCollectBenchmark.recordAndCollect                             DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5  9538995141.800 ±  95720490.562   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate              DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5           0.636 ±         0.030  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm         DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5     6363548.800 ±    305261.174    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                   DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5             ≈ 0                  counts
HistogramCollectBenchmark.recordAndCollect                             DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  9042829725.000 ± 169838553.573   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate              DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           0.933 ±         0.068  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm         DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5     8849014.400 ±    654075.369    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                   DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                    DEFAULT_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                      ms
HistogramCollectBenchmark.recordAndCollect                      ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5  2616061300.000 ±  67260283.355   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate       ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5           2.391 ±         0.104  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm  ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5     6559592.000 ±    284720.892    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count            ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5             ≈ 0                  counts
HistogramCollectBenchmark.recordAndCollect                      ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  2624043408.200 ±  48730935.089   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate       ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.420 ±         0.167  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm  ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5     9411476.800 ±    308800.163    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count            ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time             ZERO_MAX_SCALE_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                      ms

After:

Benchmark                                                                                  (aggregationGenerator)  (aggregationTemporality)  Mode  Cnt           Score           Error   Units
HistogramCollectBenchmark.recordAndCollect                                              EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5  3461289016.800 ± 207765909.326   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate                               EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           2.759 ±         0.168  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm                          EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5    10010963.200 ±     37770.109    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                                    EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                                     EXPLICIT_BUCKET_HISTOGRAM                     DELTA    ss    5           2.000                      ms
HistogramCollectBenchmark.recordAndCollect                                              EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  3443194525.200 ±  51746699.440   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate                               EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.034 ±         0.128  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm                          EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5    10956763.200 ±    513597.377    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                                    EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                                     EXPLICIT_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                      ms
HistogramCollectBenchmark.recordAndCollect                             DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5  9458527550.000 ± 170497488.996   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate              DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5           0.671 ±         0.015  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm         DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5     6654689.600 ±     37502.937    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                   DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5             ≈ 0                  counts
HistogramCollectBenchmark.recordAndCollect                             DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  9090781224.800 ±  61234816.395   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate              DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           0.925 ±         0.097  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm         DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5     8814665.600 ±    942971.029    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count                   DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time                    DEFAULT_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.000                      ms
HistogramCollectBenchmark.recordAndCollect                      ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5  2570711000.000 ± 110162829.176   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate       ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5           2.469 ±         0.107  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm  ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5     6654652.800 ±     37585.400    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count            ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                     DELTA    ss    5             ≈ 0                  counts
HistogramCollectBenchmark.recordAndCollect                      ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5  2660751041.800 ±  59159354.485   ns/op
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate       ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           3.195 ±         0.103  MB/sec
HistogramCollectBenchmark.recordAndCollect:·gc.alloc.rate.norm  ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5     8914393.600 ±    173088.998    B/op
HistogramCollectBenchmark.recordAndCollect:·gc.count            ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                  counts
HistogramCollectBenchmark.recordAndCollect:·gc.time             ZERO_MAX_SCALE_BASE2_EXPONENTIAL_BUCKET_HISTOGRAM                CUMULATIVE    ss    5           1.000                      ms

@jack-berg jack-berg requested a review from a team February 7, 2023 23:54
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Base: 91.07% // Head: 91.07% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (9b27666) compared to base (feb0297).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5184   +/-   ##
=========================================
  Coverage     91.07%   91.07%           
+ Complexity     4868     4861    -7     
=========================================
  Files           548      548           
  Lines         14373    14365    -8     
  Branches       1378     1370    -8     
=========================================
- Hits          13090    13083    -7     
  Misses          891      891           
+ Partials        392      391    -1     
Impacted Files Coverage Δ
...opencensusshim/internal/metrics/MetricAdapter.java 89.24% <ø> (ø)
...tor/DoubleBase2ExponentialHistogramAggregator.java 98.63% <ø> (-0.04%) ⬇️
...gator/DoubleExplicitBucketHistogramAggregator.java 97.87% <ø> (+1.95%) ⬆️
...l/data/ImmutableExponentialHistogramPointData.java 100.00% <ø> (ø)
...ics/internal/data/ImmutableHistogramPointData.java 95.45% <ø> (-0.38%) ⬇️
...telemetry/sdk/trace/export/BatchSpanProcessor.java 94.48% <0.00%> (-0.69%) ⬇️
...ava/io/opentelemetry/sdk/internal/RateLimiter.java 100.00% <0.00%> (+5.88%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants