Snow Leopard includes a new compiler, clang. Much of my work involves C++, which clang can’t handle. Which is a bummer, as the static analysis is so useful. But Opal is an Objective-C application, so I tried switching from GCC 4.2. I had to tweak a few things (clang doesn’t like the GCC -Wunreachable-code option), but mostly it gave a few different warnings.
And it’s about twice as fast. On my MacBook Air 2.13 GHz, it took GCC about 58 seconds to build Opal (with its plugins). Clang took about 32 seconds. (This isn’t all compile time — it also includes copying files into the bundle.) I built twice each time in case caching made a difference.
Opal isn’t very compute-bound, so I didn’t notice any speed differences from using the LLVM backend. As for code size, the bundle is 4,463,702 bytes, compared to 4,328,838 from GCC 4.2 and 4,349,342 from GCC 4.0. In many cases, bigger code runs slower, but Apple claims that LLVM generates better code. They pay a lot of attention to performance, so I’m going to believe them on this.
So I’m planning on using clang for the next Opal update.