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

specialize simplelru(span's lruMap) for attributes only #328

Merged
merged 4 commits into from
Nov 18, 2019
Merged

specialize simplelru(span's lruMap) for attributes only #328

merged 4 commits into from
Nov 18, 2019

Conversation

paivagustavo
Copy link
Member

This specialize the simplelru map for attributes only, reducing the number of usages of interface{}, consequently reducing the number of allocations.

The reduction of the number of allocs range from 8%~42% on our current benchmarks. Related benchmarks:

name                                             old time/op    new time/op    delta
StartEndSpan/AlwaysSample-6                        2.47µs ±27%    2.17µs ±28%  -11.93%  (p=0.004 n=20+20)
SpanWithAttributes_4/AlwaysSample-6                4.70µs ±30%    4.43µs ±17%     ~     (p=0.515 n=20+18)
Span_SetAttributes/SetAttribute/AlwaysSample-6     4.21µs ±37%    4.62µs ±12%   +9.82%  (p=0.018 n=20+20)
Span_SetAttributes/SetAttributes/AlwaysSample-6    5.44µs ±29%    4.17µs ±28%  -23.42%  (p=0.000 n=20+20)
SpanWithAttributes_8/AlwaysSample-6                8.09µs ±15%    6.00µs ±27%  -25.79%  (p=0.000 n=20+20)
SpanWithAttributes_all/AlwaysSample-6              9.41µs ±36%    8.62µs ± 9%     ~     (p=0.256 n=20+20)
SpanWithAttributes_all_2x/AlwaysSample-6           17.5µs ±26%    12.9µs ±31%  -26.49%  (p=0.000 n=20+20)

name                                             old alloc/op   new alloc/op   delta
StartEndSpan/AlwaysSample-6                          816B ± 0%      800B ± 0%   -1.96%  (p=0.000 n=20+20)
SpanWithAttributes_4/AlwaysSample-6                1.74kB ± 0%    1.60kB ± 0%   -8.26%  (p=0.000 n=20+20)
Span_SetAttributes/SetAttribute/AlwaysSample-6     1.55kB ± 0%    1.41kB ± 0%   -9.28%  (p=0.000 n=20+20)
Span_SetAttributes/SetAttributes/AlwaysSample-6    1.74kB ± 0%    1.60kB ± 0%   -8.26%  (p=0.000 n=20+20)
SpanWithAttributes_8/AlwaysSample-6                2.45kB ± 0%    2.18kB ± 0%  -11.11%  (p=0.000 n=20+20)
SpanWithAttributes_all/AlwaysSample-6              3.22kB ± 0%    2.88kB ± 0%  -10.43%  (p=0.000 n=20+20)
SpanWithAttributes_all_2x/AlwaysSample-6           6.04kB ± 0%    5.38kB ± 0%  -10.86%  (p=0.000 n=14+18)

name                                             old allocs/op  new allocs/op  delta
StartEndSpan/AlwaysSample-6                          12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.000 n=20+20)
SpanWithAttributes_4/AlwaysSample-6                  30.0 ± 0%      21.0 ± 0%  -30.00%  (p=0.000 n=20+20)
Span_SetAttributes/SetAttribute/AlwaysSample-6       29.0 ± 0%      20.0 ± 0%  -31.03%  (p=0.000 n=20+20)
Span_SetAttributes/SetAttributes/AlwaysSample-6      33.0 ± 0%      24.0 ± 0%  -27.27%  (p=0.000 n=20+20)
SpanWithAttributes_8/AlwaysSample-6                  46.0 ± 0%      29.0 ± 0%  -36.96%  (p=0.000 n=20+20)
SpanWithAttributes_all/AlwaysSample-6                55.0 ± 0%      34.0 ± 0%  -38.18%  (p=0.000 n=20+20)
SpanWithAttributes_all_2x/AlwaysSample-6             96.0 ± 0%      55.0 ± 0%  -42.71%  (p=0.000 n=20+20)

If this is is something we are willing to do, we should probably do the same for events and links as well.

This also make sure we only add attributes/links if isRecording.

Move method to export the attributes list to attributeMap.
@jmacd jmacd merged commit 3495d74 into open-telemetry:master Nov 18, 2019
@paivagustavo paivagustavo deleted the copy-of-simplelru branch November 22, 2019 03:19
hstan referenced this pull request in hstan/opentelemetry-go Oct 15, 2020
…ion/go.mongodb.org/mongo-driver (#328)

* Bump go.mongodb.org/mongo-driver

Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](mongodb/mongo-go-driver@v1.4.0...v1.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
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