gcc should just add a 'remove fibonnaci' optimisation pass, that just optimises this away entirely, and stop people using this benchmark.
This is one of the stupidest things I've ever heard of -- I'm going to be really mean now. They want me to use a compiler remotely, every time I want to recompile? So if their servers go down, or my internet connection goes down, I can't even run my compiler? And they have all the source code I've ever compiled?
And their evidence for their amazing super-awesome compiler is... optimising fibonnaci? Which their compiler (any compiler) could easily be detecting and special-casing? (I'm surprised more don't actually).
Finbonacci is utterly meaningless. Here, my language does Fibonacci(45) in 0.001 seconds, it compiles any output to the python code `print 1134903170`.
I'd be particularly curious regarding what the optimized version yields for "fibonacci(78)" - plain JS will get this one wrong, as it runs out of mantissa bits and gives 14472334024676220 instead of the correct 14472334024676221.
Doing an asm.js-style transformation to use machine integers would offer some speedup, but the behavior would differ due to 64-bit integers vs 53-bit.
My production-ready PHP-to-JS compiler pragmatically optimises for highest efficiency in real-world synthetic benchmark scenarios by only being capable of compiling the factorial function.
Maybe they've never heard of the Community vs. Enterprise licensing schemes before.
Also, I find it amusing that they think compilation is an attractive feature to people on RasPis and smartphones, when those devices can already just directly run JS. If this worked (which I'm still not convinced of), it would really only be of use to high-performance server writers.
edit: also, iirc, Haskell can reduce out a fibonacci sequence if you pass it a constant
That the C code is compiled with "gcc -O7" tells me just about everything I need to know about the soundness of these experiments. "-O3" and "-Ofast" are the highest optimisation levels, where "-Ofast" includes optimisations that break some standard-compliant programs (mostly -ffast-math).
Not to mention that comparing running times for a single run on an unspecified machine isn't "benchmarking".
Yeah, it's hardly a benchmark. The information what kind of CPU they are using is also missing (why no -march=native?).
Despite how unbelievable it looks, I would love to see contents of the final binary to see what is really happening there. gcc code looks quite alright in this case: https://godbolt.org/g/R6iBup
My totally unsupported guess is that they detect pure functions and add implicit memoization. It is relative easy to implement, has good benchmark times if N is big enough but not too big to make the trick obvious, but under the hood it use more memory than you expected.
He should benchmark vs the nexe [1] and (commercial) EncloseJS [2] JavaScript compilers (both grabbing V8's untraced/unoptimized initial translation to x86_64 as I understand).
While I personally wouldn't buy it if I can help it, I don't see a problem with commercially offering compilers per se.
The thing I'm having trouble with is potential injection of code (backdoors, etc.) and other security concerns, eg. if a customer of yours is having an imminent issue with your product, you're dependent on the third party tool provider.
Or, the code gets tail recursion optimized, turned into an iterative solution whilst the c code is recursive? If it was doing the same thing its unlikely to be faster.
Turning the recursive formulation of the Fibonacci function into an iterative loop is not easy for a compiler (unless you just program that specific pattern into it).
However, this "benchmark" is totally dominated by function call overhead, and it's quite conceivable that you can engineer your compiler to optimise for that case at the expense of others. You could do it quickly enough by unrolling the recursion a few times. This can cause the code to balloon in size in the general case, but not for this simple case.
It's also not particularly impressive to optimise a Javascript program that does not exhibit any complex behaviour. Again, you can just write a compiler that detects whether the Javascript program is straightforward, and if so, turns it into C or whatnot. Without being able to see what the compiler is doing, there is no way to know.
Also, "Compiler as a Service" may be a good idea for some cases (like farming an aggressively optimising but very slow compiler off to the cloud), but as the default case? No way.
A compiler is software that IMHO really should not be SAAS. I don't want to pay monthly for everything in my life. Honestly, I want to pay a monthly fee for as little as possible. The worst part of it all is what happens if you go out of business and I've build an entire product with "NectarJS"? Can't I even compile the code then?
NodeJS already is fast, and if one really needs something faster maybe use something else than javascript?
This is one of the stupidest things I've ever heard of -- I'm going to be really mean now. They want me to use a compiler remotely, every time I want to recompile? So if their servers go down, or my internet connection goes down, I can't even run my compiler? And they have all the source code I've ever compiled?
And their evidence for their amazing super-awesome compiler is... optimising fibonnaci? Which their compiler (any compiler) could easily be detecting and special-casing? (I'm surprised more don't actually).