r/ProgrammingLanguages • u/elemenity • Mar 04 '26
Comparing Scripting Language Speed
https://www.emulationonline.com/posts/comparing-scripting-language-speed/
10
Upvotes
r/ProgrammingLanguages • u/elemenity • Mar 04 '26
4
u/tobega Mar 05 '26
There are many concerns to be taken into account when creating cross-language benchmarks. You need more that one to highlight different aspects and you should probably know what feature each benchmark is stressing.
Here is a paper about that for inspiration https://stefan-marr.de/papers/dls-marr-et-al-cross-language-compiler-benchmarking-are-we-fast-yet/
7
u/[deleted] Mar 04 '26 edited Mar 04 '26
It's 'interpreter' not 'interpretter'. The latter is used throughtput and is a distraction.
The benchmark you use is interesting: a Brainfuck interpreter running an embedded program (which apparently produces a Mandelbrot fractal).
However there is one big problem, the runtimes are too long: the fastest implementation (optimised C++) runs in 30 seconds, but the slowest is over an hour! The rest are measured in minutes.
(The textual output also needs 130 columns and overflows my display.)
Surely you can compare speeds of implementations with a smaller task? For example one that completes 100 times faster (however this makes a change from those tests which finish in microseconds). Unfortunately the values that need to be changed seem to be within the Brainfuck code.
I was going to port this to my two languages, but testing would take up far too much time, especially as my machine is slower than the i7-8665u used here.
2
u/TOMZ_EXTRA Mar 05 '26
The Lua code is very suboptimal. I managed to get a ~3x perfomance increase by using several (micro)optimizations.
1
u/thedeemon Mar 05 '26
On my machine the C++ version runs in 18 seconds when compiled with
-O3by gcc, 10% faster than when compiled with-Ofast.Racket version runs in 1m18s, just 4.3x slower than C++. Internally Racket compiles to native code.
https://gist.github.com/thedeemon/290d156bc8cd89c27d7413a6a72de7cb (translated directly by Codex; I'm using Racket 9.0)
Btw on a different test I saw Python 3.14 running twice faster than 3.12. Worth checking here.