Similar to getFileIDLocal patch, but for the version for load module.
Test with clangd (building AST with preamble), FileID scans in binary
search is reduced:
SemaExpr.cpp: 142K -> 137K (-3%)
FindTarget.cpp: 368K -> 343K (-6%)
Differential D135258
[SourceManager] Improve getFileIDLoaded. hokein on Oct 5 2022, 4:58 AM. Authored by
Details
Similar to getFileIDLocal patch, but for the version for load module. Test with clangd (building AST with preamble), FileID scans in binary SemaExpr.cpp: 142K -> 137K (-3%)
Diff Detail
Event TimelineComment Actions Nice! Just a couple of comments where we could take the opportunity to clarify the existing code. Optional.
|
This is confusing: if SLocEntry.getOffset() > SLocOffset then it means SLocOffset is *not* part the entry (entry can be pruned), but if they're equal it means it *is* part of the entry (entry should not be pruned).
Then we're pruning the entry regardless.
I think we're getting away with this because we never get here in the == case as we would have hit the cache.
But > seems clearer than >=, assuming my analysis is right.