In my experience, having done quite a lot of dynamic language benchmarks, Javascript is about as fast as PHP and both are about 6x faster than Python.
Has someone looked at the Python code used here, if it has any obvious gotchas?
In my experience, having done quite a lot of dynamic language benchmarks, Javascript is about as fast as PHP and both are about 6x faster than Python.
Has someone looked at the Python code used here, if it has any obvious gotchas?
~/p/not_that_slow python3.11 modified.py 5000000
-0.169075164
0.183753791
Time: 6.335 s
~/p/not_that_slow python3.11 main.py 5000000
-0.169075164
-0.169083134
Time: 48.515 s
Other than this, the only modification I made is to include a `print` statement at the end to show the time taken.EDIT: That is not actually equivalent, my bad. The iterator is consumed and the execution ends early, I didn't realize the algorith iterated over it multiple times.
And itertools is a real gem, full of lots of goodies to handle list manipulation tasks.
I’m in no way criticizing the benchmark but that’s the reason for the starker difference.
For a little more information, this is using Bun 0.2.1, which uses JavaScriptCore (JSC), a part of WebKit which powers Safari. Since I'm running on an M1 Pro (Apple's ARM chip), there is probably somewhat of a benefit in using JSC.
There are many flaws in this benchmark but the order of magnitude looks right to me: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...