6 ms·
Intel Fortran now 20% faster than C, fastest language on Shootout
- markokocic 15y agoYou have to hit F5 to reload page, since otherwise the old page will be displayed from browser cache. Probably something wrong with page cache expiration settings.
- antirez 15y agoWith Fortran this is expected, since for language semantics the compiler can perform more assumptions compared to C, resulting into more optimizations.
- gcp 15y agoFor the shootout, all the source code is visible to the compiler (though at least GCC needs to be told so with a flag). So I don't think there's much more assumptions that can be made.
- wolf550e 15y agoAFAIK GCC doesn't add "restrict" to pointers by itself. Fortran semantics mean that pointers are "restrict" by default.
- gcp 15y agoHow does this matter when the compiler can see all the source code? It can see what the pointers are pointing to and determine if there is aliasing. Feel free to point out the source code in the shootout where this would somehow not be the case. Shouldn't be hard to find if you focus on the benchmarks where Fortran beats C heavily. Additionally, the argument about restrict is flawed because it can be added to the C code too, so it can't be an advantage of Fortran.
- xyzzyz 15y agoIt is impossible write a compiler that reads a C source code and for every point in program decides if two names visible from that point cannot alias each other. You cannot do that even under assumption that every code path may be visited.
- gcp 15y agoI agree it is impossible in the general case (it's obviously impossible when input data controls program flow, for example). But I don't think that has much meaning for the benchmarks under consideration, which, by the way, one would expect to sidestep the obvious pitfalls here. The impossibility of solving aliasing in the general case doesn't stop C compiler writers from implementing alias analysis.
- shasta 15y agoI assume xyzzyz was referring to the undecidability of the halting problem, not just user input. Comparisons to the halting problem are often made inappropriately, as would be the case here, since the compiler doesn't need to answer whether an arbitrary program contains aliasing, but only identify programs that admit arguments (often simple ones) demonstrating that they don't alias. It's still undecidable, though.
- figglesonrails 15y agovoid* p1; void* p2; p2 = function(p1); Do p1 and p2 alias? Note: function() is in a *.so file, no source available. How many times do you have all of the source code available for analysis?
- gcp 15y agoI pointed out specifically that all source code is available exactly for this reason. The original claim was that "for Fortran this is expected" which isn't true at all in this condition. So aliasing information can't explain the performance difference.
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- hnwh 15y agoFortran's always been faster than C
- masklinn 15y agoMost of Fortran's gain is on mandelbrot, but it sucks on binary-trees (10x slower than C). It also tends to use 2x more memory (with a 23x outlier on fannkuch): http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=ifc&lang2=gcc http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...
- gcp 15y agoFrom a simple look, the Fortran code seems to have an additional optimization that allows it to avoid a lot of checking for overflows in the innermost loop.
- larsberg 15y agobinary-trees is rough to beat C on. It involves allocating and traversing some pretty gigantic data structures, and the C code is optimized by using region-style allocation to avoid all of the individual calls to free (or garbage collections in a GC'd language). From the CPU usage, it also looks like they also haven't parallelized the Fortan version yet, though even at ideal speedup it'll still lose. I've been doing some tuning work on our parallel dialect of ML, and many of the C programs are fairly well-optimized, though mandelbrot still has some room for improvement.
- chj 15y agoThese reports are worse than useless. Any person with good understanding of computing knows that implementation plays a huge part in it. Why people wasting their time comparing speed of different programming languages while they should focus on different implementations. I guess the latter one is difficult so people all try to avoid it, and the first one is just so easy to do and everybody is doing it.
- wheaties 15y agoThat fact stands out immensely. The Scala code and java code should be equal as the first can be written exactly like the second. Don't even see Clojure. Hate to see what times they get there.
- verroq 15y agoExcept Scala has no 'break' (that isn't a hack using exceptions), this makes imitating imperative style difficult and some syntaxical sugar should no doubt ensure that Scala will always be slower than Java.
- BindGuice 15y agoClojure is there but where is clang?
- igouy 15y agoclang is waiting for someone like you, who wants to spend their time building language implementations on the LLVM toolchain and measuring program runtimes - http://shootout.alioth.debian.org/demo2/which-programming-languages-are-fastest.php?llvmgcc=on&clang=on&java=on&ghc=on&csharp=on&fsharp=on http://shootout.alioth.debian.org/demo2/which-programming-la... http://shootout.alioth.debian.org/help.php#llvm http://shootout.alioth.debian.org/help.php#llvm
- igouy 15y agoWhat would be interesting about Scala programs written exactly like Java programs? Hint: If you want to check for some text on a web page, use page search.
- biasedstudy 15y agoIntel Fortran vs gcc ??? How about Intel Fortran vs. Intel C ? How about gcc C vs. gcc Fortran ? Hyper-optimized compiler for Intel architecture beats compiler designed to be portable to many, many target architectures? Not very shocking.
- deleted 15y ago[deleted]
- stephencanon 15y agoThis is a really terribly done study, with a misleading title to boot. First, even if we take the conclusion as given, "Fortran" isn't faster than "C". The median of one set of programs, compiled with one Fortran compiler with one set of options and run on one processor, is faster than the median of another set of programs compiled with one C compiler with one set of one and run on that processor. This tells us approximately nothing. If you only expand your consideration to include the whole distribution of programs they tested, GCC actually looks better than iFort (eg. there is a single program which ran 2x faster with iFort, but multiple programs ran more than 2x slower). Median is a spectacularly poor choice of metric, especially with so few samples in the distribution. But also: Intel also makes a C compiler. Why wasn't that used? How were these benchmark programs chosen? Etc. This study says close to nothing about "Fortran" and "C", or about any of the other languages involved.
- mrgoldenbrown 15y agoThis is a really terrible criticism of the linked page, with a misleading first statement to boot. Where do you see the word study? The title at the top of the page says "Computer Language Benchmarks Game". How is calling it a benchmark game misleading? That's what it is, and it doesn't pretend to be anything else - it is a sorted list of benchmarks run on one particular configuration.
- stephencanon 15y agoThey conducted a series of experiments, and reported their results. If that's not a "study", I don't know what is. The fact that the authors acknowledge that it's a "game" doesn't change that. What is misleading is the title on the link: "Intel Fortran now 20% faster than C".
- igouy 15y agoWhat makes you think the title shown on Hacker News has anything to do with the linked website? Can you find the statement "Intel Fortran now 20% faster than C" anywhere on the linked website? > the authors acknowledge that it's a "game" See http://shootout.alioth.debian.org/dont-jump-to-conclusions.php#namegame http://shootout.alioth.debian.org/dont-jump-to-conclusions.p...
- tomandersen 15y agoFortran was designed to munch numbers. As most programs are written by people who will not spend much time getting that last 3x of performance out, a language like Fortran makes sense for the number crunchers. Its easier to screw up in C. These kinds of tests are not all that great, as the code is optimized. Its un-optimized code that matters, since that powers the world.
- seltzered_ 15y agoFWIW, This Developer's Life has an interesting interview with a fortran programmer this month: http://thisdeveloperslife.com/post/2-0-7-dinosaurs http://thisdeveloperslife.com/post/2-0-7-dinosaurs
- onedognight 15y agoIs there some reason that gfortran from the GCC project is not on the list of compilers for this language shootout? Instead only the branded "Intel Fortran" compiler shows up. Hmm.