[clang] [clang][modules] Avoid allocations when reading blob paths (PR #113984)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 28 21:52:53 PDT 2024
================
@@ -1341,9 +1341,22 @@ class ASTReader
serialization::InputFile getInputFile(ModuleFile &F, unsigned ID,
bool Complain = true);
+ /// Buffer we use as temporary storage backing resolved paths.
+ SmallString<256> PathBuf;
----------------
jansvoboda11 wrote:
Because if callers construct fresh buffers all the time, each call to `ResolveImportedPath()` allocates. If the buffer is global, the function never allocates again after the longest path has been resolved.
https://github.com/llvm/llvm-project/pull/113984
More information about the cfe-commits
mailing list