3 ms·
GCC C vs Intel Fortran : http://shootout.alioth.debian.org/u64/benchmark.php?test=all&lang=gcc&lang2=ifc&box=1 http://shootout.alioth.debian.org/u64/benchmark.p
by chancho 17y ago
GCC C vs Intel Fortran : http://shootout.alioth.debian.org/u64/benchmark.php?test=all&lang=gcc&lang2=ifc&box=1 http://shootout.alioth.debian.org/u64/benchmark.php?test=all...
Intel C vs Intel Fortran : http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=icc&lang2=ifc&box=1 http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...
(I'm not even going to link to the GCC Fortran benchmarks. They're embarrassing.)
C is no slower than Fortran on any of those benchmarks, and on some it cleans Fortran's clock. The aliasing issue is the only thing Fortran has going in its favor, but clearly its not ubiquitous. The n-body benchmark, for instance, is fairly typical numerical code. You might even think, since it's simultaneously reading and writing through multiple pointers of the same type, that aliasing is an issue, but its not. And in the rare case that it becomes an issue, there's compiler hints (e.g. C99 restrict) for that.
Picking Fortran over C solely because of aliasing worries is premature optimization of the worst kind.
- likpok 17y agoThis matches with my experiences with ICC doing kernel development. It would vectorize loops and break out the SIMD instructions where gcc would not. It was quite strange the first time looking through the objdump seeing things like punpwlkd and xmm. And then discovering what -fast would do to things (it makes icc look at your whole program to optimize, so it does things like ignore CDECL and uses whatever registers it can.