Skip to content

Conversation

@bantonsson
Copy link
Contributor

Changes

This breaks out the context benchmark work from #2378 so the performance changes can be seen in the PR.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@bantonsson bantonsson requested a review from a team as a code owner February 25, 2025 16:28
@codecov
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.3%. Comparing base (81fea07) to head (db82c76).
Report is 3 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2707   +/-   ##
=====================================
  Coverage   79.3%   79.3%           
=====================================
  Files        123     123           
  Lines      22660   22660           
=====================================
  Hits       17977   17977           
  Misses      4683    4683           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bantonsson bantonsson force-pushed the ban/context-benchmarks branch from 1980b5a to db82c76 Compare February 25, 2025 16:34
@bantonsson bantonsson changed the title Context benchmarks perf: More Context benchmarks Feb 25, 2025
};

// Run this benchmark with:
// cargo bench --bench current_context
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// cargo bench --bench current_context
// cargo bench --bench context_attach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦🏼‍♂️ Thanks. I'll change it.

context_type: &str,
context: &Context,
) {
let _restore = Context::current().attach();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let _restore = Context::current().attach();
let _context_guard = Context::current().attach();

nits!

fn single_cx(cx: Context) {
let cx = black_box(cx.attach());
let _ = black_box(dummy_work());
drop(cx);
Copy link
Member

Choose a reason for hiding this comment

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

is it intentional to do explicit drop of cx? Any reason why it is done so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The drop will happen anyway, so I can remove it.

}

#[inline(never)]
fn overlapping_cx(cx1: Context, cx2: Context) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Rename to "out_of_order_cx_drop"

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Looks good!
Left some nits, not a blocker. Eager to see improvements here in upcoming PRs!

@scottgerring
Copy link
Member

LGTM too. Once this and #2706 is in you can merge down from main into your context fix branch and we should get the perf change announcements. I'll make sure the other one is ready to go this morning.

@cijothomas cijothomas merged commit 2bf05f6 into open-telemetry:main Feb 26, 2025
22 of 23 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