[cfe-dev] clang-rename performance oddness
Kirill Bobyrev via cfe-dev
cfe-dev at lists.llvm.org
Wed Aug 17 01:12:16 PDT 2016
I had similar discussion with Manuel couple weeks ago.
This is what I have:
kbobyrev at kbobyrev:~$ time ~/Documents/dev/build/Debug/llvm/bin/clang-rename
-offset=9298 -new-name=Options -i
kbobyrev at kbobyrev:~$ time
kbobyrev at kbobyrev:~$ time
What Manuel pointed out, unless you are building in Release mode Clang AST
Parser is really really slow. Thus, we only saw performance problems in AST
parsing, clang-rename routine seemed OK for me at that point.
Are you sure you have 60+ seconds in RelWithDebInfo mode, not in Debug
mode? If you are, please send me some additional info about how to
reproduce the problem.
On Tue, Aug 16, 2016 at 10:07 PM, Miklos Vajna via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> [ Resent this time without attaching a screenshot. ]
> I've recently tried to use clang-rename on a larger codebase
> (LibreOffice's core.git repo ), and while the tool works correctly, it's
> surprisingly slow.
> I've tried 3 actions:
> 1) Compiling a (somewhat random selected) file,
> sw/source/uibase/uiview/pview.cxx with clang++: it takes about 4 seconds
> on my machine.
> 2) Using LibreOffice's own simple rename tool  to rename 11 members
> of a class referenced in that translation unit: also about 4 seconds.
> 3) Doing the same with clang-rename: 76 seconds.
> So I expected that clang-rename does something stupid, but after
> building the LLVM codebase with -DCMAKE_BUILD_TYPE=RelWithDebInfo and
> used callgrind to see where time is spent, it seems that the time is
> mostly spent in clang::ParseAST().
> (One more thing I did not check is if -DLLVM_ENABLE_ASSERTIONS=ON is the
> source of that slowdown; but I doubt such a 19x slowdown is due to
> assertions being enabled.)
> I see no obvious silly in any of its callers, like calling it again and
> again inside a for() cycle or something like that. Any idea what might
> cause the 4 vs 76 seconds?
> I guess the problem is not specific to the above source file, but in
> case it's interesting, happy to write up and share precise, reproducible
> steps to trigger the problem.
> I'm not sure what's a good way to share a callgrind profile, but I've
> uploaded a kcachegrind screenshot; what is a bit surprising to me is
> that the time (it seems) is spent in a single clang function that's
> called only once by clang-rename, and I guess the same function is also
> called by clang++.
> Any ideas how to debug such a problem?
>  git clone git://anongit.freedesktop.org/libreoffice/core
>  https://cgit.freedesktop.org/libreoffice/contrib/dev-tools/
>  https://people.freedesktop.org/~vmiklos/2016/Screenshot_
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev