Hasty Briefsbeta

Making the Clang AST Leaner and Faster

10 days ago
  • #Clang
  • #C++
  • #CompileTimeOptimization
  • Modern C++ codebases heavily rely on templates, leading to massive abstract syntax trees (AST).
  • Recent improvements to Clang's AST make type representation smaller, simpler, and faster to create.
  • Build-time improvements include a 7% reduction in stdexec's slowest test and a 5% improvement in Chromium builds.
  • The patch removes ElaboratedType, storing elaboration and qualifiers directly in RecordType.
  • NestedNameSpecifier is now a compact, tagged pointer, reducing memory usage and uniquing costs.
  • The new representation simplifies template instantiation transforms and enriches the AST without overhead.
  • RecordType nodes are created lazily, further optimizing performance.