[cfe-dev] clang builds chromium

Douglas Gregor dgregor at apple.com
Thu Oct 14 16:41:45 PDT 2010


On Oct 14, 2010, at 1:56 PM, Nico Weber wrote:

> On Wed, Oct 13, 2010 at 10:08 AM, Nico Weber <thakis at chromium.org> wrote:
>> Hi,
>> 
>> as of clang r116145, clang successfully builds all of chromium
>> (browser & test binaries) in both Debug and Release configurations.
>> The resulting browser binary even seems to work. Thank you for fixing
>> our bug reports so quickly! :-)
>> 
>> We have a continuous clang builder on both linux and mac, to make sure
>> our code stays clang-compatible, linked from
>> http://code.google.com/p/chromium/wiki/Clang . If you're interested in
>> which compiler flags we use, you can look at the compile step output:
>> http://build.chromium.org/buildbot/waterfall.fyi/builders/Chromium%20Mac%20Debug%20Clang/builds/795/steps/compile/logs/stdio
>> (the flags are slightly different for mac and linux).
>> 
>> 
>> Here are some random initial comparisons with gcc:
>> 
>> 
>> Build time
>> 
>> I built chrome.xcodeproj (i.e. just the browser) and all.xcodeproj
>> with both clang and gcc in both Debug and Release configurations and
>> measured the compile times, three times each. Results:
>> 
>> Building chrome with clang in Debug [1]
>> real    40m28.591s
>> real    39m51.426s
>> real    39m44.070s
>> 
>> Building chrome with gcc in Debug
>> real    44m55.732s
>> real    45m18.087s
>> real    45m3.671s
>> 
>> Building all with clang in Debug
>> real    70m8.669s
>> real    69m37.114s
>> real    70m26.698s
>> 
>> Building all with gcc in Debug
>> real    78m1.581s
>> real    78m6.648s
>> real    77m34.363s
>> 
>> Building chrome with clang in Release
>> real    43m58.864s
>> real    43m28.477s
>> real    43m29.998s
>> 
>> Building chrome with gcc in Release
>> real    57m6.050s
>> real    56m44.654s
>> real    58m8.629s
>> 
>> Building all with clang in Release
>> real    79m13.448s
>> real    79m0.107s
>> real    79m19.669s
>> 
>> Building all with gcc in Release
>> real    147m53.350s
>> real    146m35.010s
>> real    150m11.451s
>> 
>> clang is 10%-87% faster when building. [2]
>> 
>> 
>> Executable size
>> 
>> clang
>> Chromium: 12.6 kB
>> Chromium Framework: 45.2 MB
>> Chromium Framework.framework.dSYM DWARF file: 69.4 MB
>> 
>> gcc
>> Chromium: 12.6 kB
>> Chromium Framework: 52.1 MB
>> Chromium Framework.framework.dSYM DWARF file: 75.5 MB
>> 
>> Clang's output is almost 10% smaller.
>> 
>> 
>> Executable speed
>> 
>> I measured JavaScript performance. Since that's mostly dependent on
>> code generated by V8, it's not the greatest test, but it was easy to
>> do.
>> 
>> clang v8 (3 runs)
>> 5655
>> 5562
>> 5637
>> 
>> clang sunspider
>> Total: 270.0ms +/- 0.9%
>> 
>> gcc v8 (3 runs)
>> 5532
>> 5542
>> 5480
>> 
>> gcc sunspider
>> Total: 271.2ms +/- 9.1%
>> 
>> As expected, this looks mostly the same.
>> 
>> I also ran a slightly modified version of
>> http://trac.webkit.org/export/69591/trunk/WebCore/benchmarks/parser/html-parser.html
>> (changed to force a full garbage collection after every run, to reduce
>> variance), which checks a bit more than just JavaScript performance:
>> 
>> clang:
>> avg 5077.75
>> stdev 173.6965385377613
>> 
>> gcc
>> avg 5163.65
>> stdev 122.2183599137216
>> 
>> This looks good, too.
>> 
>> 
>> 
>> I didn't run most of the test binaries yet. (The one I ran passed all tests.)
>> 
>> 
>> Nico
>> 
>> 
>> 
>> 1: Some files in the gpu project take very very long to build with
>> clang and require a ton of memory. There's possibly a clang bug in
>> there, and the build time here might go down a few minutes once that's
>> fixed. I'll try to find a reduced test case.
> 
> Quick follow-up: This is just template instantiation being slow. It's
> also a problem in gcc. There's nothing clang can do here.


We know of some remaining inefficiencies in Clang's template instantiation, particularly w.r.t. source-location information in types, so there may be hope of Clang getting faster/smaller here.

	- Doug



More information about the cfe-dev mailing list