[cfe-dev] clang-rename performance oddness

Miklos Vajna via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 17 07:22:27 PDT 2016

Hi Kirill,

On Wed, Aug 17, 2016 at 10:12:16AM +0200, Kirill Bobyrev <kbobyrev at google.com> wrote:
> 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.

Yes, I'm comparing RelWithDebInfo times of clang++ and clang-rename,
both the trunk version. I can see the problem with renaming a couple of
identifiers on the LLVM codebase as well, here is a reproducer script:

echo running clang++
time (cd $HOME/git/llvm/workdir/tools/clang/lib/Sema; $HOME/git/llvm/workdir/bin/clang++ -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I$HOME/git/llvm/workdir/tools/clang/lib/Sema -I$HOME/git/llvm/tools/clang/lib/Sema -I$HOME/git/llvm/tools/clang/include -I$HOME/git/llvm/workdir/tools/clang/include -I$HOME/git/llvm/workdir/include -I$HOME/git/llvm/include  -fno-omit-frame-pointer -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O2 -g -DNDEBUG -fPIC    -fno-exceptions -fno-rtti -o CMakeFiles/clangSema.dir/SemaLambda.cpp.o -c $HOME/git/llvm/tools/clang/lib/Sema/SemaLambda.cpp)
echo running clang-rename
time $HOME/git/llvm/workdir/bin/clang-rename rename-all \
        -offset 5552 -new-name EnclosingDC2 \
        -offset 6036 -new-name CurScopeIndex2 \
        -offset 9302 -new-name IsCapturingVariable2 \
        -offset 10038 -new-name NoLambdaIsCaptureCapable2 \
        -offset 10260 -new-name CanCaptureThis2 \
        -offset 10562 -new-name IndexOfCaptureReadyLambda2 \
        -offset 14754 -new-name ManglingContextDecl \
        -offset 13833 -new-name Kind2 \
        -offset 11784 -new-name IsGenericLambda2 \
        -offset 11980 -new-name Class2 \
        -offset 16950 -new-name MethodName \
        -export-fixes=/dev/null $HOME/git/llvm/tools/clang/lib/Sema/SemaLambda.cpp

Replace $HOME/git/llvm/workdir/ with your RelWithDebInfo build dir, and
hopefully it'll run out of the box. The first line just compiles the
file, the second renames 11 randomly picked identifiers in that file.
The output on my machine is:

running clang++

real    0m5.735s
user    0m5.608s
sys     0m0.124s
running clang-rename

real    0m41.038s
user    0m40.864s
sys     0m0.204s

It sounds like we do some kind of parsing for each symbol to be renamed.
However, I don't see where that happens, even after reading the profile
I linked in the other mail of this thread.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160817/22b18257/attachment.sig>

More information about the cfe-dev mailing list