Fight for the Internet 1!

Tuesday, April 7, 2009


So I have been reading up on the LLVM, and on integrating it with GCC. I care about a possible integration of the system because I want Linux programs to continue to be fast. The compiler is an important component in that speed. Furthermore, unlike Microsoft, the GCC project does not have direct communication with Intel Compiler designers, so it is important that GCC compiler be damn good.

From what I read online, it seems like some people like to decry the GCC project as being difficult to contribute to, and perhaps it is... or was. I don't personally believe this after reading experts from The Cathedral and the Bazaar. But I also do not have a lot of experience with the GCC project personally. If nothing else, the history of the GCC since the late 1990s has definitely been one of better community involvement.

Benchmark Data
There is a project called LLVM-GCC which is the combination of GCC and LLVM and I have been trying to collect information on performance between the two compilers. Here follows some of the things I have found.

To note at the beginning, the speed of the compilers is dramatically effected by the CPU architectures they are compiling on. So, an X86_64 architecture compared to Darwin/PPC could give wildly different results for the same code. Many of these tests don't even mention their architectures.

At Cliff Hacks, we see the GCC outperforming LLVM when maximum optimization is enabled (-O3). Unfortunately comparing GCC with -O0 and LLVM standard is fairly invalid, since -O0 effectively ties GCC's hands for speed.

At Laurovenancio, we see LLVM-GCC outperforming GCC by about 2-4%, but this is using GCC 4.1.x. I know from other research that there have been some serious speed improvements in 4.2 and 4.3, and I know that 4.4 is continuing these efforts with Stack management improvements. Because of these updates, I would not take these results as very reliable now.

Leonardo-m's blog is the most recent (2008-12-14) and best illustration of results I have found so far.

These results seem to indicate an overall small speed increase when using LLVM-GCC. The nbody section was a bug which has been reported and fixed already.

If nothing else, the GCC is still an amazing piece of work to be competing so well, even with all of "supposed shortcomings" that I see frequently mentioned in relation to LLVM.

One reason that LLVM has not been adopted into GCC officially is that there are license conflicts between the two projects. I don't really care to list them now, but basically the GCC want to keep things GPL'd and LLVM is more interested in a BSD style license. This is probably because of funding and influence from Apple, their sponsor. I don't fault either party for their intents.

A Final Thought
If LLVM-GCC should become a significantly better/faster/superior/prettier compiler over the GCC, I wonder if there will be a movement to adopt it as the official compiler for Linux distribution packages? I mean, would Debian or Ubuntu start to build their packages with LLVM-GCC if it was a superior compiler? Or would they stick with GCC? Does license matter more than speed? Does "the official Linux compiler" stamp from GCC matter more the perceived performance?

I just hope that if LLVM-GCC should become a "better" compiler that the Linux community, specifically the package maintainers, will consider it as a possibility.

No comments:

Post a Comment