Originally posted by XorEaxEax
View Post
Announcement
Collapse
No announcement yet.
FreeBSD 10 To Use Clang Compiler, Deprecate GCC
Collapse
X
-
Well what all that tells me? I used to like FreeBSD but I see more and more value in the GPL. Pretty obviously being forced to choices by sponsors, aka by money, isn't really my vision of open source (yeah they're allowed to have that vision, but I find the free software one much more attractive).
Comment
-
Originally posted by LinuxID10T View PostLets just forget for the second that X11 already has far, far more features than Wayland. Computers are getting faster all the time, if feature bloat is a problem, it shouldn't be now. I am sick of people that keep trying to reinvent the wheel. WHY?!? Yeah, X11 is old, but it works. The time can be better put into far more useful things. Just my opinion.
Comment
-
Originally posted by vertexSymphony View PostSorry, but GPL-licensed projects are driven by money too (for example : http://lwn.net/Articles/395961/) ... the manpower difference between a full-time programmer and a hobbist is BIG and you see that when decisions are made
Comment
-
Originally posted by LinuxID10T View PostSee, the thing is that Clang will pretty much always be years behind in performance.
I made my own benchmark script for 7-zip which I ran on a core i7, comparing GCC 4.7 against Clang 3.0, I tested both the synthetic benchmark which is built into 7-zip and also did a real-world benchmark of actually compressing a file (in this case an arch linux ISO, I'm an arch guy, what can I say), here are the results at different optimization levels:
Code:GCC -O0 -march=corei7 1m2.420s (real-world benchmark, less is better) GCC -O0 -march=corei7 5354 (synthetic benchmark, more is better) Clang -O0 -march=corei7 1m1.143s (real-world benchmark, less is better) Clang -O0 -march=corei7 5446 (synthetic benchmark, more is better) GCC -O1 -march=corei7 0m32.008s (real-world benchmark, less is better) GCC -O1 -march=corei7 11375 (synthetic benchmark, more is better) Clang -O1 -march=corei7 0m35.316s (real-world benchmark, less is better) Clang -O1 -march=corei7 11650 (synthetic benchmark, more is better) GCC -O2 -march=corei7 0m31.076s (real-world benchmark, less is better) GCC -O2 -march=corei7 11704 (synthetic benchmark, more is better) Clang -O2 -march=corei7 0m34.550s (real-world benchmark, less is better) Clang -O2 -march=corei7 11808 (synthetic benchmark, more is better) GCC -O3 -march=corei7 0m29.432s (real-world benchmark, less is better) GCC -O3 -march=corei7 11890 (synthetic benchmark, more is better) Clang -O3 -march=corei7 0m34.335s (real-world benchmark, less is better) Clang -O3 -march=corei7 11796 (synthetic benchmark, more is better)
And looking past the synthetic benchmark and at the real-world benchmark which is what actually reflects the REAL usage of 7-zip, GCC wins across the board, with a very noticeable performance increase.
Here's the script I made (sorry for my poor bash script-fu), it will automatically download p7zip and an arch linux iso (just the first time, not every run!) which it will compress in the real-world test. There's also support for ICC (intel compiler) testing there but I didn't use it for this test. The results of the benchmarking is saved in p7zip-results.txt in the same directory from which you run the script:
Code:#!/bin/bash name=p7zip_ version=9.20.1 dir=$name$version results=../p7zip-results.txt makefile=makefile.linux_amd64 arg="./bin/7za a -mx9 -m0=LZMA2:d128m -mmt dummy.7z archlinux-2011.08.19-netinstall-i686.iso" arg2="./bin/7za b" # change flags according to the optimization settings you want to benchmark gccflags="-O3 -march=corei7" clangflags="-O3 -march=corei7" iccflags="-O3 -march=corei7" # uncomment compilers to be tested (obviously they need to have been installed) gcc=1 clang=1 #icc=1 if [ ! -d $dir ]; then echo "Downloading and extracting p7zip..." wget -q http://downloads.sourceforge.net/project/p7zip/p7zip/${version}/p7zip_${version}_src_all.tar.bz2 bzip2 -q -d "$dir"_src_all.tar.bz2 tar xf "$dir"_src_all.tar fi cd $dir if [ ! -e archlinux-2011.08.19-netinstall-i686.iso ]; then echo "Downloading iso..." wget -q http://ftp.ds.hj.se/pub/os/linux/archlinux/iso/2011.08.19/archlinux-2011.08.19-netinstall-i686.iso fi # access the file for cache purposes else the first real-world test will likely suffer in disk read performance. tar cvf dummy.tar archlinux-2011.08.19-netinstall-i686.iso rm dummy.tar if [ ! -z $gcc ]; then # GCC ---------------------------------------------------------------------------------------------------- cp $makefile makefile.machine sed -i "s/OPTFLAGS=-O/OPTFLAGS=$gccflags/" makefile.machine make clean make -j5 clear echo "Benchmarking..." bench=`{ time ${arg}; } 2>&1 | grep real | awk '{print $2}'` echo -e "GCC\t\t$gccflags\t\t$bench\t(real-world benchmark, less is better)" >> $results bench=`{ ${arg2}; } 2>&1 | grep Tot | awk '{printf $4}'` echo -e "GCC\t\t$gccflags\t\t$bench\t\t(synthetic benchmark, more is better)" >> $results rm dummy.7z fi if [ ! -z $clang ]; then # CLANG/LLVM --------------------------------------------------------------------------------------------- cp $makefile makefile.machine sed -i "s/OPTFLAGS=-O/OPTFLAGS=$clangflags/" makefile.machine sed -i 's/CXX=g++/CXX=clang++/' makefile.machine sed -i 's/CC=gcc/CC=clang/' makefile.machine make clean make -j5 clear echo "Benchmarking..." bench=`{ time ${arg}; } 2>&1 | grep real | awk '{print $2}'` echo -e "Clang\t\t$clangflags\t\t$bench\t(real-world benchmark, less is better)" >> $results bench=`{ ${arg2}; } 2>&1 | grep Tot | awk '{printf $4}'` echo -e "Clang\t\t$clangflags\t\t$bench\t\t(synthetic benchmark, more is better)" >> $results rm dummy.7z fi if [ ! -z $icc ]; then # ICC --------------------------------------------------------------------------------------------- cp $makefile makefile.machine sed -i "s/OPTFLAGS=-O/OPTFLAGS=$iccflags/" makefile.machine sed -i 's/CXX=g++/CXX=icpc/' makefile.machine sed -i 's/CC=gcc/CC=icc/' makefile.machine make clean make -j5 clear echo "Benchmarking..." bench=`{ time ${arg}; } 2>&1 | grep real | awk '{print $2}'` echo -e "ICC \t\t$iccflags\t\t$bench\t(real-world benchmark, less is better)" >> $results bench=`{ ${arg2}; } 2>&1 | grep Tot | awk '{printf $4}'` echo -e "ICC \t\t$iccflags\t\t$bench\t\t(synthetic benchmark, more is better)" >> $results rm dummy.7z fi echo "Done! Open '$results' to see the benchmark results."
Comment
-
more free-libre compilers == good
As a developer I am happy to see clang becoming robust enough to be considered a replacement for gcc.
Competition is good, folks.
gcc's only competetion (on *nix) for a long time has been proprietary compilers from the likes of intel and IBM.
...AND
There is one area where clang kicks the crap out of gcc:
COMPILER ERRORS
No kidding. gcc sometimes gives you a useful error, but often it is meaningless or even misleading.
I have at times installed clang just to recompile some c++ code where it was failing to compile under gcc and the error was completely incomprehensible.
gcc is that bad.
I am a big fan of the GPL, but NiH notwithstanding, clang is a welcome addition.
Comment
-
Originally posted by XorEaxEax View PostI made my own benchmark script for 7-zip which I ran on a core i7, comparing GCC 4.7 against Clang 3.0, I tested both the synthetic benchmark which is built into 7-zip and also did a real-world benchmark of actually compressing a file (in this case an arch linux ISO, I'm an arch guy, what can I say), here are the results at different optimization levels:
Comment
-
Originally posted by kiputnik View PostI suggest you try using profile guided optimization on the GCC build. In extreme cases I noticed a 50%~100% speedup when using PGO, and most people ignore this really great optimization.
This is also likely why most people don't use it, although of course it can be automated like done in Firefox, x264 etc. And yes it can seriously yield great results in cpu intensive code since it uses gathered runtime information which allows the optimizer to make much better choices concerning loop unrolling, branch prediction etc, of course as always sometimes the gains are big, sometimes barely noticeable which obviously depends on how good the optimizer was at correctly estimating without the benefit of runtime data.
For this particular test I wanted the flags to be the same (Clang/LLVM doesn't have PGO), and also stick to the standard -Ox flags even though GCC could potentially be faster by enabling further optimizations.
Comment
-
Originally posted by kiputnik View PostI suggest you try using profile guided optimization on the GCC build. In extreme cases I noticed a 50%~100% speedup when using PGO, and most people ignore this really great optimization.
Comment
Comment