[PATCH] D45815: [libclang] Add options to limit skipping of function bodies
Nikolai Kosjar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 20 07:39:55 PDT 2018
nik added a comment.
In https://reviews.llvm.org/D45815#1073418, @ilya-biryukov wrote:
> In https://reviews.llvm.org/D45815#1072094, @nik wrote:
>
> > @ilya: Using SkipFunctionBodies_AllExceptTemplates for the preamble might be also useful for clangd.
>
>
> Unfortunately, that's also the biggest performance win you get when skipping the function bodies.
> I.e. most codebases do not have function bodies in headers unless the function is template.
>
> Have you measured the performance gain of skipping only non-template functions, but not skipping the template ones?
> Would that really make a significant difference for any real codebase?
Here are some rough numbers, based on LIBCLANG_TIMING=1 output: https://dpaste.de/os39/raw
Reparses of Qt Creator's texteditor.cpp
Without any skipping of function bodies in the preamble: 1.9s
Skipping all function bodies in the preamble: 1.0s
Skipping all function bodies in the preamble except function template bodies: 1.2s
Reparses of Clang's SemaDecl.cpp
Without any skipping of function bodies in the preamble: 1.7s
Skipping all function bodies in the preamble: 0.59s
Skipping all function bodies in the preamble except function template bodies: 0.64s
Hmm, that indicates that template function bodies are actually not that
dominant, which I also haven't thought. Now I'm doubting the correctness of
my patch/tests.
I'll recheck this on Tuesday. Until then, you/someone might want to give this also a shot.
================
Comment at: include/clang/Frontend/SkipFunctionBodies.h:18
+enum SkipFunctionBodiesKind {
+ SkipFunctionBodies_None,
+ SkipFunctionBodies_All,
----------------
ilya-biryukov wrote:
> Maybe make it `enum class` and remove the name prefix from enumerators?
> I.e. `enum class SkipFunctionBodiesKind { None, ....`
Will do.
Repository:
rC Clang
https://reviews.llvm.org/D45815
More information about the cfe-commits
mailing list