[LLVMdev] LLVM compile speed significantly slower than GCC (w/ test case)

Matt Fischer mattfischer84 at gmail.com
Thu Jul 19 15:55:49 PDT 2012


I've been doing some profiling of LLVM on our codebase, to see how it
stacks up to the existing GCC build that we do.  The primary thing I'm
focusing on at the moment is build speed, and in this regard LLVM
seems to be pretty all over the map.  On some files it seems to go
quite a bit faster than GCC, and on others it's slower, leading to an
aggregate build time for our repository that's roughly the same as
GCC.

Some IRC discussions suggested that you guys might be interested in
seeing an example of a file that goes appreciably slower, so I managed
to isolate one that's completely self-contained.  It's a relatively
stock implementation of the SHA1 algorithm, so it should be a pretty
straightforward file to follow, as well as being a relatively
data-intensive piece of code.

I compiled the file with both compilers for the arm-none-eabi triple.
The numbers I get are as follows:

GCC (4.5.2, Windows build from CodeSourcery) - With -O0: 110ms, with -O2: 215ms
Clang/LLVM (Release mode, LLVM git hash 7f5714f4..., clang git hash
9d9cf5...) - With -O0: 110ms, with -O2: 640ms

The compilers are essentially identical for the -O0 case, but when
compiling with -O2, LLVM takes almost three times as long as GCC.

I'm not sure whether this file is unusual in some way, such that
fixing whatever makes this slow wouldn't have much of an effect on
other files, or if this is evidence of some problem that's broad
enough to improve the compile speed of a wide variety of files.  If
anybody is interested in investigating the discrepancy, though, I'd
love to hear about it.

Thanks,
Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sha1test.c
Type: text/x-csrc
Size: 9173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120719/0acd4224/attachment.c>


More information about the llvm-dev mailing list