[clang] [clang] Speedup getFileIDLocal with a separate offset table. (PR #146604)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 2 06:21:51 PDT 2025
================
@@ -719,6 +719,8 @@ class SourceManager : public RefCountedBase<SourceManager> {
/// Positive FileIDs are indexes into this table. Entry 0 indicates an invalid
/// expansion.
SmallVector<SrcMgr::SLocEntry, 0> LocalSLocEntryTable;
+ /// An in-parallel offset table, merely used for speeding up FileID lookup.
+ SmallVector<SourceLocation::UIntTy> LocalLocOffsetTable;
----------------
erichkeane wrote:
Because of the size/cache sensitivity of this, might it be better to not use the SmallVector and either use a normal std::vector (no small-vector opt, see the table above does this with the `, 0`), or a very large small-vector-opt here? Do we have a good idea what size these usually do?
https://github.com/llvm/llvm-project/pull/146604
More information about the cfe-commits
mailing list