Skip to content

opentelemetry-api: remove unnecessary copy in iterator#5288

Merged
lzchen merged 3 commits into
open-telemetry:mainfrom
codeboten:codeboten/remove-dict-copy
Jun 11, 2026
Merged

opentelemetry-api: remove unnecessary copy in iterator#5288
lzchen merged 3 commits into
open-telemetry:mainfrom
codeboten:codeboten/remove-dict-copy

Conversation

@codeboten

@codeboten codeboten commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

The list of keys should be all that's needed for the iterator on a Mapping. Will rebase after #5287

Type of change

Please delete options that are not relevant.

  • Small improvement

How Has This Been Tested?

Ran benchmarks and got the following comparison:

Attrs CPU Before (ns) CPU After (ns) CPU Δ Mem Before (B) Mem After (B) Mem Δ
1 90.0 90.8 +0.8% 120 96 -20.0%
10 131.1 134.0 +2.2% 208 160 -23.1%
50 324.4 287.2 -11.5% 1,520 480 -68.4%
128 656.3 594.0 -9.5% 3,264 1,088 -66.7%

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Benchmark tests have been added
  • Documentation has been updated

@MikeGoldsmith MikeGoldsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lint error on the new benchmark test, but this looks awesome. Thanks @codeboten 🚀

@codeboten

Copy link
Copy Markdown
Contributor Author

Yah, was waiting on the other pr i opened before rebasing. Thanks for the review!

The list of keys should be all that's needed for the iterator

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
@codeboten codeboten force-pushed the codeboten/remove-dict-copy branch from 2747a83 to afeb819 Compare June 11, 2026 17:20
@codeboten codeboten marked this pull request as ready for review June 11, 2026 17:20
@codeboten codeboten requested a review from a team as a code owner June 11, 2026 17:20
@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Jun 11, 2026
@codeboten

Copy link
Copy Markdown
Contributor Author

The failure appears unrelated to this change

@lzchen lzchen added this pull request to the merge queue Jun 11, 2026
Merged via the queue into open-telemetry:main with commit 51c1d18 Jun 11, 2026
479 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants