Skip to content

Commit

Permalink
Improve lookup_external cache hit rate with reordered symbols.
Browse files Browse the repository at this point in the history
We were loading the same external files over and over in a build
that had its symbols reordered with a PGO-based order file.
  • Loading branch information
mstange committed Feb 10, 2024
1 parent d3904ab commit 59a03a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions samply-api/src/symbolicate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ impl<'a, 'h: 'a, H: FileAndPathHelper<'h>> SymbolicateApi<'a, 'h, H> {
}

// Look up any addresses whose debug info is in an external file.
// The symbol_manager caches the most recent external file.
// Since our addresses are sorted, they usually happen to be grouped by external
// file, so in practice we don't do much (if any) repeated reading of the same
// external file.
// The symbol_manager caches the most recent external file, so we sort our
// external addresses by ExternalFileAddressRef before we do the lookup,
// in order to get the best hit rate in lookup_external.
external_addresses.sort_unstable_by(|(_, a), (_, b)| a.cmp(b));

for (address, ext_address) in external_addresses {
if let Some(frames) = self
Expand Down

0 comments on commit 59a03a7

Please sign in to comment.