allocate the underlying data of Template kind separately, this would reduce AST memory usage
- TemplateArgumentLocInfo 24 => 8 bytes
- TemplateARgumentLoc 48 => 32 bytes
- DynTypeNode 56 => 40 bytes
Paths
| Differential D87080
[AST] Reduce the size of TemplateArgumentLocInfo. ClosedPublic Authored by hokein on Sep 3 2020, 2:58 AM.
Details Summary allocate the underlying data of Template kind separately, this would reduce AST memory usage
Diff Detail
Event TimelineComment Actions Nit on the commit message: I think this is TemplateArgumentLoc 48 -> 32 bytes, and DynTypedNode 56 -> 40 bytes.
hokein marked 2 inline comments as done. Comment Actionsaddress review comments:
Comment Actions Looks good apart from a minor technical issue with the traits. Would it be possible to compile some big file in LLVM (probably doesn't matter much which, Sema something?) and observe if there's a significant change in overall ASTContext size?
Comment Actions
~3% saving (measuring the ASTContext::.getASTAllocatedMemory)
rsmith added inline comments.
Comment Actions Forgot to mention, 3% memory saving is huge, way more than I expected (was mostly just hoping for no regression).
This revision is now accepted and ready to land.Sep 21 2020, 2:46 AM This revision was landed with ongoing or failed builds.Sep 21 2020, 4:09 AM Closed by commit rGaf29591650c4: [AST] Reduce the size of TemplateArgumentLocInfo. (authored by hokein). · Explain Why This revision was automatically updated to reflect the committed changes. hokein marked an inline comment as done.
Revision Contents
Diff 293133 clang/include/clang/AST/Expr.h
clang/include/clang/AST/TemplateBase.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/TemplateBase.cpp
clang/lib/AST/TypeLoc.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/SemaTemplateVariadic.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
|
I think this is it:
(Or just % alignof(Expr) == 0 if you want a weaker condition)