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

Cache the result of Demangling #1124

Merged
merged 1 commit into from
Apr 5, 2023
Merged

Cache the result of Demangling #1124

merged 1 commit into from
Apr 5, 2023

Conversation

Swatinem
Copy link
Member

@Swatinem Swatinem commented Apr 5, 2023

Demangling can be an expensive operation, which also happens for every frame and is not deduplicated for the same function names shared across threads. Furthermore, we capture errors for demangling failures, to eventually be able to improve those. However we are being spammed with up to 8 of those errors a second, and they are highly duplicated too, making it difficult to actually find new cases we don’t handle yet.

So lets cache all the things, to avoid duplicated work and spamming S4S events.

The change to get_relative_caller_addr is a driveby refactoring as clippy was rightfully complaining about too many fn arguments.

#skip-changelog

Demangling can be an expensive operation, which also happens for every frame and is not deduplicated for the same function names shared across threads.
Furthermore, we capture errors for demangling failures, to eventually be able to improve those. However we are being spammed with up to 8 of those errors a second, and they are highly duplicated too, making it difficult to actually find new cases we don’t handle yet.

So lets cache all the things, to avoid duplicated work and spamming S4S events.
@Swatinem Swatinem requested a review from a team April 5, 2023 14:49
@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Merging #1124 (aea03cb) into master (9d34afe) will increase coverage by 0.07%.
The diff coverage is 80.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1124      +/-   ##
==========================================
+ Coverage   73.81%   73.89%   +0.07%     
==========================================
  Files          86       86              
  Lines       12717    12748      +31     
==========================================
+ Hits         9387     9420      +33     
+ Misses       3330     3328       -2     

@Swatinem Swatinem enabled auto-merge (squash) April 5, 2023 15:10
Copy link
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

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

I think this is a great idea 👍

Comment on lines +268 to +278
);
relative_addr.and_then(|addr| {
symbolicate_native_frame(
demangle_cache,
symcache,
lookup_result,
addr,
frame,
index,
)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: IMO this is nicer with ?.

Suggested change
);
relative_addr.and_then(|addr| {
symbolicate_native_frame(
demangle_cache,
symcache,
lookup_result,
addr,
frame,
index,
)
})
)?;
symbolicate_native_frame(
demangle_cache,
symcache,
lookup_result,
relative_addr,
frame,
index,
)

@Swatinem Swatinem merged commit 4ad4a4b into master Apr 5, 2023
@Swatinem Swatinem deleted the moka-all-the-things branch April 5, 2023 15:40
Swatinem added a commit that referenced this pull request Apr 6, 2023
A followup to this review comment: #1124 (review)
Swatinem added a commit that referenced this pull request Apr 6, 2023
A followup to this review comment: #1124 (review)
Swatinem added a commit that referenced this pull request Apr 6, 2023
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.

2 participants