Hacker News new | ask | show | jobs
by CJefferson 3382 days ago
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).

5 comments

I came here to leave this comment and found you. Thanks.

This is not a benchmark on any regard. I thought we were past the stage of optimizing to specific microbenchmarks and then showcasing those.

If you're not going to show me real performance, at least show me Octane https://chromium.github.io/octane/ or something similar.

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

gcc already optimises away loops like for (i = 0; i < n; i++) s += i;

It wouldn't be too much of a stretch to detect and optimise away code that computes linearly recurrent sequences.

gcc removes recursion in that case: https://godbolt.org/g/R6iBup