Skip to content

Conversation

@costela
Copy link
Member

@costela costela commented Jul 19, 2025

This PR includes 2 minor and one sensible performance improvements:

  • minor: avoid the memory cost of a string context key
  • minor: avoid nil-checks by directly setting spanNameFunc
  • use slice pools for attributes and options

The last one in particular has a sensible impact on allocations:

cpu: 12th Gen Intel(R) Core(TM) i7-1250U
          │  old.bench  │           new.bench           │
          │   sec/op    │   sec/op     vs base          │
Tracer-12   1.179m ± 3%   1.174m ± 3%  ~ (p=0.684 n=10)

          │   old.bench   │              new.bench               │
          │     B/op      │     B/op      vs base                │
Tracer-12   10.261Ki ± 0%   9.221Ki ± 0%  -10.13% (p=0.000 n=10)

          │ old.bench  │             new.bench              │
          │ allocs/op  │ allocs/op   vs base                │
Tracer-12   93.00 ± 0%   76.00 ± 0%  -18.28% (p=0.000 n=10)

@costela costela merged commit 69d7eb7 into main Jul 24, 2025
3 checks passed
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