FreeBSD 9.1: LLVM/Clang Battling GCC

Written by Michael Larabel in Operating Systems on 7 February 2013 at 10:07 AM EST. Page 1 of 4. 41 Comments.

With LLVM/Clang having become the default FreeBSD x86 compiler as of last year and the recent FreeBSD 9.1 release shipping not only LLVM/Clang but also the libc++ library, new benchmarks were carried out of FreeBSD 9.1 looking at its two stock compilers.

FreeBSD 9.1 bundles in LLVM/Clang 3.1 and it also has present GCC 4.2.1. The GNU Compiler Collection is still present in the FreeBSD world since Clang doesn't yet build all of the available packages present and there's other CPU architectures besides x86/x86_64 where Clang doesn't work too well. GCC 4.2.1 was the last GPLv2 release of the Free Software Foundation compiler before re-licensed to GPLv3, which is why the stock compiler hasn't been upgraded and one of the key reasons the BSD camps have been promoting Clang and other alternatives like the Portable C Compiler. There's other versions of GCC available from the FreeBSD ports collection, but the benchmarking in this article is just looking at the stock GCC vs. LLVM/Clang on FreeBSD/PC-BSD 9.1. The PC-BSD 9.1 "Isotope" amd64 image was used during testing.

While FreeBSD 9.1 already has Clang and libc++ present, FreeBSD 10 moves ahead with the GCC deprecation. Aside from liking the more permissive license of LLVM and Clang, developers have also become fond of Clang for faster compile times while using less RAM. In the Linux world there's been similar efforts within Gentoo and even Debian experiments. The broad effort to build the Linux kernel with LLVM/Clang continues as well though there's still work ahead for both x86 and ARM architectures.

Comparing the GCC 4.2.1 and LLVM Clang 3.1 compilers as found on PC-BSD 9.1 was from an Intel Core i7 3770K "Ivy Bridge" system. Benchmarks were done with the latest Phoronix Test Suite 4.4-Forsand development code, which features enhanced BSD benchmarking support.

For those just interested in the compiler performance using the latest releases of LLVM/Clang and GCC, read LLVM/Clang 3.2 Compiler Competing With GCC. This article is just about the out-of-the-box FreeBSD 9.1 compiler binary performance.


Related Articles