[cfe-dev] Clang versus GCC speed
csdavec at swan.ac.uk
Fri Nov 20 15:04:53 CST 2009
On 20 Nov 2009, at 18:55, Douglas Gregor wrote:
> On Nov 20, 2009, at 10:36 AM, David Chisnall wrote:
>> I just did some tests with Objective-C programs and found
>> clang much slower than GCC 4.2, with an optimized build of LLVM and
>> Clang and a stock build of GCC.
> This isn't what we're seeing. We're seeing Clang being consistently
> faster than GCC 4.2.
> Are you certain that you built LLVM and Clang in Release-Asserts?
> Debug builds are horribly slow, and Release builds are still a bit
> slower than Release-Asserts builds.
I was using the wrong binary. Running the tests again, there's about
a 10% variation in speeds each time I run clang and gcc, but they both
end up being approximately the same speed. Using -fsyntax-only on
GNUstep's Cocoa.h takes slightly longer with clang than GCC on
average, although the fastest result for clang is slightly better than
the slowest result for gcc.
Are your tests relative to Apple's GCC? It's a lot slower than FSF
GCC for Objective-C, at least - not sure why, but FSF GCC can usually
compile a couple of files before Apple GCC reports the first warning
With a Release-Asserts build, clang is very slightly slower than the
GCC 4.2.1 build included with the FreeBSD 8 base system for Objective-
C (although it does produce warnings that GCC doesn't produce and
supports a few more language features).
I took the preprocessed Cocoa.h from GNUstep to a Mac and ran clang
and gcc -fsyntax-only and, indeed Apple's GCC takes a bit more than
twice as long to run. The same file on FreeBSD takes about the same
time between FSF GCC and Clang (Release-Asserts build). I'm not sure
if this is just an Objective-C thing, or if Apple's GCC is much slower
for C too.
-- Sent from my Difference Engine
More information about the cfe-dev