4 ms·
This is a pretty terrible implementation of fib(n).
by richardwhiuk 6y ago
This is a pretty terrible implementation of fib(n).
- meetups323 6y agoIt's a common approach to measuring function spawn cost.
- da_chicken 6y agoMaybe, but it's also why synthetic benchmarks are not convincing. Maybe node better handles a bad pattern, but if performance is a concern to this level we're more concerned about functionally equivalent good patterns even if the code is very different.
- atleta 6y agoI think GP meant how the fib function was written (and not why it was chosen for the measurement). The `if n == 1 or n == 0` thing hurts my eyes too.
- nullcat 6y agoRegardless node IS definitively one of the fastest interpreted platforms around. It is well known that it is faster than python. Python wins in other areas, including being a much much better designed language.
- tracker1 6y agoProbably comes from V8 (JS engine in node), likely being the most heavily optimized language runtime engine ever made.
- locotower 6y agoYeah, it's definitely because of that.
- killsgnadfamily 6y agoAgreed. They have some of the smartest people working on that.