To make building preambles faster and keep them smaller.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 13361 Build 13361: arc lint + arc unit
Event Timeline
I haven't done proper benchmarks, but here are some numbers from running this on my machine:
Sizes of preamble with (before the change) and without (after the change) functon bodies:
File | Before | After |
ClangdUnit.cpp | 49.58MB | 34.79MB |
SemaDecl.cpp | 47.03MB | 31.51MB |
All C++11 stl includes | 13.15MB | 8.75M |
Time to build the preamble (just a single run, not a proper benchmark):
File | Before | After |
ClangdUnit.cpp | 4.39s | 2.49s |
SemaDecl.cpp | 4.28s | 2.29s |
All C++11 stl includes | 1.40s | 0.80s |
Time to build AST and provide diagnostics after preamble is ready (just a single run, not a proper benchmark):
File | Before | After |
ClangdUnit.cpp | 1.75s | 0.18s |
SemaDecl.cpp | 2.30s | 0.74s |
Those are some impressive numbers!
Excited to see this land, thanks for tracking down all the weird problems.
clangd/ClangdUnit.cpp | ||
---|---|---|
536 | Nit: I think the comment/assert focus too much on the 'what' at the expense of the 'why' - just the first sentence here is probably enough (without the second and without the assert). And below, something like: // For the main file, we do want the AST and diagnostics for function bodies. |
- Updated a comment
clangd/ClangdUnit.cpp | ||
---|---|---|
536 | That looks better. Updated the comments, thanks. |
It could. The problem with ASTUnit is that it returns all diagnostics from store_diag_begin/end, not just the ones from the current file.
Skipping function bodies would mean no diagnostics from the preamble. Which may or may not be fine, I'm not sure how important those diagnostics are for the clients.
Nit: I think the comment/assert focus too much on the 'what' at the expense of the 'why' - just the first sentence here is probably enough (without the second and without the assert).
And below, something like: