<div dir="ltr">Hi Miklos,<div><br></div><div>I had similar discussion with Manuel couple weeks ago.</div><div><br></div><div>This is what I have:</div><div><i><br></i></div><div><u><b>Debug build</b></u></div><div><div>kbobyrev@kbobyrev:~$ time ~/Documents/dev/build/Debug/llvm/bin/clang-rename -offset=9298 -new-name=Options -i ~/Documents/dev/src/llvm/tools/clang/tools/extra/clang-rename/tool/ClangRename.cpp</div><div><br></div><div>real<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>1m11.103s</div><div>user<span class="gmail-Apple-tab-span" style="white-space:pre">  </span>1m10.534s</div><div>sys<span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0m0.548s</div></div><div><br></div><div><b><u>RelWithDebInfo build</u></b></div><div><div>kbobyrev@kbobyrev:~$ time ~/Documents/dev/build/RelWithDebInfo/llvm/bin/clang-rename -offset=9298 -new-name=Options -i ~/Documents/dev/src/llvm/tools/clang/tools/extra/clang-rename/tool/ClangRename.cpp</div><div><br></div><div>real<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0m7.830s</div><div>user<span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0m5.476s</div><div>sys<span class="gmail-Apple-tab-span" style="white-space:pre">    </span>0m2.318</div></div><div><br></div><div><u><b>Release build</b></u><br></div><div><div>kbobyrev@kbobyrev:~$ time ~/Documents/dev/build/Release/llvm/bin/clang-rename -offset=9298 -new-name=Options -i ~/Documents/dev/src/llvm/tools/clang/tools/extra/clang-rename/tool/ClangRename.cpp</div><div><br></div><div>real<span class="gmail-Apple-tab-span" style="white-space:pre">      </span>0m4.553s</div><div>user<span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0m4.364s</div><div>sys<span class="gmail-Apple-tab-span" style="white-space:pre">    </span>0m0.184s</div></div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>--</div><div>Kirill</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 16, 2016 at 10:07 PM, Miklos Vajna via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
[ Resent this time without attaching a screenshot. ]<br>
<br>
I've recently tried to use clang-rename on a larger codebase<br>
(LibreOffice's core.git repo [1]), and while the tool works correctly, it's<br>
surprisingly slow.<br>
<br>
I've tried 3 actions:<br>
<br>
1) Compiling a (somewhat random selected) file,<br>
sw/source/uibase/uiview/pview.<wbr>cxx with clang++: it takes about 4 seconds<br>
on my machine.<br>
<br>
2) Using LibreOffice's own simple rename tool [2] to rename 11 members<br>
of a class referenced in that translation unit: also about 4 seconds.<br>
<br>
3) Doing the same with clang-rename: 76 seconds.<br>
<br>
So I expected that clang-rename does something stupid, but after<br>
building the LLVM codebase with -DCMAKE_BUILD_TYPE=<wbr>RelWithDebInfo and<br>
used callgrind to see where time is spent, it seems that the time is<br>
mostly spent in clang::ParseAST().<br>
<br>
(One more thing I did not check is if -DLLVM_ENABLE_ASSERTIONS=ON is the<br>
source of that slowdown; but I doubt such a 19x slowdown is due to<br>
assertions being enabled.)<br>
<br>
I see no obvious silly in any of its callers, like calling it again and<br>
again inside a for() cycle or something like that. Any idea what might<br>
cause the 4 vs 76 seconds?<br>
<br>
I guess the problem is not specific to the above source file, but in<br>
case it's interesting, happy to write up and share precise, reproducible<br>
steps to trigger the problem.<br>
<br>
I'm not sure what's a good way to share a callgrind profile, but I've<br>
uploaded a kcachegrind screenshot[3]; what is a bit surprising to me is<br>
that the time (it seems) is spent in a single clang function that's<br>
called only once by clang-rename, and I guess the same function is also<br>
called by clang++.<br>
<br>
Any ideas how to debug such a problem?<br>
<br>
Thanks,<br>
<br>
Miklos<br>
<br>
[1] git clone git://<a href="http://anongit.freedesktop.org/libreoffice/core" rel="noreferrer" target="_blank">anongit.freedesktop.org/<wbr>libreoffice/core</a><br>
[2] <a href="https://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/clang/rename.cxx" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/<wbr>libreoffice/contrib/dev-tools/<wbr>tree/clang/rename.cxx</a><br>
[3] <a href="https://people.freedesktop.org/~vmiklos/2016/Screenshot_20160816_215756.png" rel="noreferrer" target="_blank">https://people.freedesktop.<wbr>org/~vmiklos/2016/Screenshot_<wbr>20160816_215756.png</a><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Best regards,<div>Kirill Bobyrev</div></div></div>
</div>