Improve DWARF symbolization performance#1541
Open
d-e-s-o wants to merge 2 commits intolibbpf:mainfrom
Open
Conversation
Change Unit to store its gimli::Unit and language in OnceCell wrappers, introducing ensure_dw_unit() as the single access point. All units continue to be eagerly constructed via Unit::new() for now, but the OnceCell plumbing prepares for deferring construction when .debug_aranges data is available. Signed-off-by: Daniel Müller <deso@posteo.net>
Move the .debug_aranges lookup before gimli::Unit construction in Units::parse(). When aranges provide address ranges for a CU, use Unit::new_deferred() to skip the expensive abbreviation and line program header parsing entirely. The full gimli::Unit is constructed lazily on first access via ensure_dw_unit(). This changes the range source priority: .debug_aranges is now checked before DW_AT_ranges. This is necessary because we cannot read DW_AT_ranges without constructing the gimli::Unit (which is the expensive operation we are deferring). In practice both sources are assumed to agree since they are generated by the same toolchain. Our main vmlinux based symbolization benchmarks see a vast improvement from the lazy unit construction, because less work needs to happen overall (the vast majority of CUs are not queried): > main/symbolize_dwarf_no_lines > time: [11.456 ms 11.798 ms 12.163 ms] > change: [−92.099% −91.860% −91.645%] (p = 0.00 < 0.02) > Performance has improved. > main/symbolize_dwarf > time: [11.102 ms 11.165 ms 11.253 ms] > change: [−92.389% −92.322% −92.250%] (p = 0.00 < 0.02) > Performance has improved. Signed-off-by: Daniel Müller <deso@posteo.net>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1541 +/- ##
==========================================
- Coverage 95.50% 95.27% -0.23%
==========================================
Files 56 56
Lines 9534 9579 +45
==========================================
+ Hits 9105 9126 +21
- Misses 429 453 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please see individual commits for descriptions.