News for hackers. Stuff that matters.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by masklinn on Tuesday February 09, 2021 @01:05PM (#26080624)
Indeed. Furthermore this basically just benches function call overhead by using the worst possible implementation of fib().

Function call is a well-known weak point of cpython, even amongst all its other weak points performance-wise.

It's hard to express how utterly uninteresting and useless TFA is, and if its author is surprised by the result… really the only component this tells us about is the author.

> Would be much more interesting to compare to pypy.

I'm not sure it is more interesting at all, let alone much more, but here are the results on my (obviously much slower than TFA's) machine:

    > python3.9 --version
    Python 3.9.1
    > python3.9 fib.py
    8555.904865264893 ms
    > pypy37 --version
    Python 3.7.9 (7e6e2bb30ac5fbdbd443619cae28c51d5c162a02, Jan 15 2021, 06:03:20)
    [PyPy 7.3.3-beta0 with GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
    > pypy37 fib.py
    715.0719165802002 ms
    > node --version
    v14.15.4
    > node fib.js
    247.19056797027588 ms
(can I note that the 12 decimal precision of the script is hilarious? Because clearly when you're benching fib(35) you need that femtosecond-scale precision)
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by zamadatix on Tuesday February 09, 2021 @01:12PM (#26080717)
Seems like an unduly harsh take. Is everyone just supposed to inherently know this fact about cpython or find it unsurprising when they run across it?

"Obviously this isn't the most comprehensive benchmark, but the results are surprising to me."

I fully agree with this and I learned something new about cpython's weakpoints today!

Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by wrs on Tuesday February 09, 2021 @01:25PM (#26080877)
It does seem a bit harsh, but I would put it like this: If you need to care about performance, then this is an extremely basic difference between the two language implementations that should not surprise you. If you don’t yet, then this is the very beginning of your education in how to care about performance—welcome to the next level!
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by dooferlad on Tuesday February 09, 2021 @01:31PM (#26080946)
Oh, I think it is a quite reasonable comment. It isn't interesting work being done in the benchmark and the benchmark itself is short.

If you want to get ultimate performance from Python then write a C function...

If you want to inform me about runtime performance then show me how the language runtimes are spending cycles. If you wish to convince me about a language being great then tell me about the engineering effort to create and then run something in production.

Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by zamadatix on Tuesday February 09, 2021 @02:14PM (#26081383)
It's a 2 sentence post, the latter of which seems to be trying to dispel the idea that it's about what you're implying it is. Uninteresting to experts in the area that consider this common knowledge maybe, not a failure of the author to do something worthwhile though.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by prepend on Tuesday February 09, 2021 @01:24PM (#26080854)
If I’m writing an article about benchmarking, then yes.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by creata on Tuesday February 09, 2021 @01:38PM (#26081024)
In the author's defence, the "article" isn't even 50 words long.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by nullcat on Tuesday February 09, 2021 @01:21PM (#26080815)
These details aren't important. It's like bench marking C++ and node and then complaining about implementation details. Node should be and is definitively faster then python in practically every bench mark.

I still prefer python over node though, but I can't deny the reality.

Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by locotower on Friday February 12, 2021 @12:39AM (#26111042)
I would say it's faster generally but not definitively.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by simple_phrases on Tuesday February 09, 2021 @01:22PM (#26080829)
Not only that, it wasn't until 3.9 that Python got optimizations for calling callables.
Re:Node.js 14 is over 20x faster than Python3.8 for fib(n) by masklinn on Tuesday February 09, 2021 @01:23PM (#26080846)
Doesn't really matter, I ran it on 3.9, it's still slow. Between the kind of language Python is and the optimisation CPython allows for itself, there is simply no way it could be competitive.