Home

Awesome

Benchmark for interpreted languages implementations.

Most programs from benchmarks game. All programs are chosen to be simplest, single-thread and without any low-level hacks. Also, the code for all languages trying to be implemented with one algorithm, use the same language constructs and containers, and be semantically similar to each other. The goal of the benchmark is to find the most successful JIT solutions. My other benchmarks: Benchmarks, Crystal Benchmarks Game.

Compare:

	* Ruby (Ruby2.7, Ruby3, Graal, Topaz, JRuby, Rbx)
	* Python (Cpython, Graal, Pypy, Cython, Jython, Nuitka, Mypyc, Codon)
	* Lua (JIT)
	* Javascript (Node, Graal)
	* PHP8.1 (JIT)
	* C, Crystal as a basis

Running on AMD Ryzen 7 3800X, 80Gb DDR-4 3200 Mghz, docker on Ubuntu 22.10.

Update: 2023-02-28 (round 1)

binarytrees

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
C++0.4450.7617.3
Crystal0.659.4522.2
Ruby2GraalVM_JVM0.6951.862200.7
Python3Cython0.8151.0124.3
C0.8750.5849.6
Python3Codon1.054.2858.2
JavascriptNode1.0850.19141.3
Ruby2GraalVM1.0850.21693.9
Ruby2JRuby_InDy1.2451.642110.1
JavascriptGraalVM_JVM1.3951.992302.4
Ruby2Topaz1.9750.2263.1
Python3GraalVM_JVM2.0252.793265.2
JavascriptGraalVM2.1650.5656.9
Ruby2JRuby2.8351.641224.6
PHPJIT2.9350.1671.8
Python3GraalVM3.4150.321362.1
Python3PYPY3.8450.21123.8
Python2PYPY3.950.22136.6
Ruby3JIT4.6150.4780.9
PHP5.8450.1868.0
Ruby2JIT6.0650.2345.1
Ruby36.1650.2657.2
LuaJIT6.7350.16307.5
Ruby26.7550.244.6
Lua15.0350.14145.2
Ruby2Rbx15.4750.34420.7
Python2Jython22.7941.39795.5
Python3MYPYC23.2542.4756.3
Python3Nuitka72.5513.73107.0
Python373.1510.1998.5
Python292.3910.22205.7

brainfuck

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Python3Codon2.0554.612.2
C++2.450.651.8
Crystal4.8759.672.8
JavascriptNode5.8850.2446.9
Python2PYPY6.3950.2257.6
Python3PYPY8.7750.2561.3
Python3GraalVM_JVM14.2253.551767.9
Ruby2GraalVM_JVM15.3152.181368.9
Ruby2GraalVM15.4740.21563.6
Ruby2Topaz17.4150.2329.9
Python3GraalVM19.2450.34871.6
JavascriptGraalVM_JVM52.0832.711151.6
Ruby2JRuby_InDy53.4832.17798.7
JavascriptGraalVM76.1620.55435.2
Python3MYPYC93.5522.89.4
Ruby2JIT102.2810.6821.1
Ruby3JIT103.9210.8324.8
Ruby2JRuby113.3111.67974.5
Ruby2115.3110.2720.9
Ruby3118.910.2622.8
Python3Cython165.9712.5410.0
Python3Nuitka181.8714.0211.1
Python2Jython> 19001.49410.9
Python2> 19000.216.4
Python3> 19000.199.4
Ruby2Rbx> 19000.351011.4

brainfuck2

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
C1.2550.230.9
Python3Codon1.9154.8812.7
Crystal1.9659.872.7
JavascriptNode3.6550.1746.0
Ruby2GraalVM_JVM4.6851.842015.0
Ruby2GraalVM5.5750.23586.4
LuaJIT8.3250.182.6
JavascriptGraalVM_JVM10.3952.11329.5
Python2PYPY11.0250.1962.5
Python3PYPY11.0350.2563.1
JavascriptGraalVM11.4250.48543.6
Python3GraalVM_JVM11.4453.341769.2
Python3GraalVM14.4750.41103.1
Ruby2Topaz22.7150.2331.8
Lua47.6740.242.2
Ruby2JRuby_InDy50.6842.07792.6
Ruby3JIT60.3730.9725.4
Ruby2JIT64.4130.7621.1
Python3MYPYC77.2522.759.4
Ruby390.8520.2822.9
Ruby2JRuby92.3721.54804.2
Ruby293.9320.2520.7
Python3142.2610.29.5
Python3Nuitka142.713.8311.1
Python2157.0910.26.3
Python2Jython189.0711.36379.3
Ruby2Rbx> 21500.35960.8

fannkuchredux

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Python3Cython0.1350.968.2
JavascriptNode0.1550.2445.4
JavascriptGraalVM_JVM0.1852.11732.1
Crystal0.1959.512.8
JavascriptGraalVM0.1950.49332.9
C0.2150.310.9
Ruby2GraalVM_JVM0.2451.82784.6
LuaJIT0.2750.22.7
Ruby2GraalVM0.2750.21330.3
Python3GraalVM_JVM0.3652.841366.3
Ruby2Topaz0.4350.2229.9
Python3GraalVM0.6150.31601.5
Python2PYPY0.7150.260.5
Python3PYPY0.7110.2657.6
PHPJIT0.7750.1316.3
Ruby2JRuby_InDy1.1951.61374.1
Lua1.6250.192.1
Python3Codon1.8254.7913.5
Ruby2JRuby2.051.59362.1
PHP2.5450.1912.0
Python3MYPYC2.7452.497.6
Python3Nuitka3.5253.7910.6
Python23.8350.216.4
Python34.0450.28.1
Ruby3JIT4.2750.4723.7
Ruby34.350.2423.0
Ruby24.3450.2520.9
Ruby2JIT4.3750.2420.8
Python2Jython4.9651.26388.4
Ruby2Rbx> 6000.34512.9

fasta

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
C0.5750.320.9
Crystal1.1510.923.4
Python3Codon1.6655.0913.5
LuaJIT1.7150.162.9
PHPJIT2.4650.1815.8
Python2PYPY2.8950.2163.9
Python3PYPY3.1950.262.4
Ruby2GraalVM_JVM3.2851.921289.1
Python3GraalVM_JVM3.5352.981139.4
JavascriptNode3.6650.2949.4
Lua3.6950.22.4
Ruby2GraalVM3.7850.21617.1
PHP4.6450.1911.8
Ruby2Topaz5.2950.2341.1
Python3GraalVM5.3650.34781.2
Python3MYPYC6.4452.897.5
Python3Cython6.8152.548.4
JavascriptGraalVM_JVM8.1352.141327.8
Python38.6550.218.0
JavascriptGraalVM10.4350.51792.0
Python3Nuitka10.9753.8710.5
Python211.5250.2619.4
Ruby3JIT14.5950.9855.4
Ruby316.2140.2853.1
Ruby2JIT17.7440.7759.7
Ruby218.1940.2259.3
Ruby2JRuby25.1531.68777.2
Ruby2JRuby_InDy26.8622.23783.0
Python2Jython30.621.41420.3
Ruby2Rbx> 8000.34540.1

knucleotide

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
LuaJIT0.7710.2927.1
PHPJIT1.9610.240.7
Python2PYPY2.0810.25132.0
C++2.0911.0530.9
Crystal2.35111.8745.8
Python3Codon2.6916.4245.3
PHP2.8710.237.2
Python3PYPY3.710.27142.1
Lua4.0110.2751.4
Python3GraalVM_JVM5.0414.391555.3
JavascriptNode5.2110.32140.9
Ruby2Topaz5.2510.42116.0
Ruby2GraalVM_JVM5.312.541590.7
Python3GraalVM5.7910.79927.6
Python26.5810.3262.9
Ruby2GraalVM8.1110.81469.2
Python3Cython8.3312.649.7
Python38.4110.2948.9
Ruby2JRuby_InDy8.5811.811044.9
Python3Nuitka8.8313.9751.5
Ruby2JRuby9.5111.79859.8
Ruby2JIT9.6610.3356.3
JavascriptGraalVM_JVM9.713.651584.4
Python2Jython9.7511.47797.9
Ruby3JIT9.9810.682.2
Ruby211.0210.3454.3
Ruby311.610.3682.8
JavascriptGraalVM13.6711.65608.5
Python3MYPYC-01.13-
Ruby2Rbx> 6000.0-

mandelbrot

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Python3Cython0.4351.178.2
C0.4550.291.0
Crystal0.4559.592.9
JavascriptNode0.4650.21115.1
JavascriptGraalVM_JVM0.4852.151347.3
LuaJIT0.550.242.4
JavascriptGraalVM0.5150.55686.2
Python3PYPY0.5450.2275.6
Python2PYPY0.5650.2273.7
PHPJIT0.5850.2216.2
Python3Codon0.6554.4951.6
Python3GraalVM_JVM0.8453.451099.8
Python3GraalVM1.1940.31687.9
Ruby2GraalVM_JVM1.3451.851137.6
Ruby2GraalVM1.3650.23385.7
Ruby2Topaz1.4750.2626.7
Lua5.3950.142.4
PHP5.5150.1912.4
Ruby2JRuby_InDy7.1251.81939.9
Python2Jython12.7941.38588.9
Ruby2JRuby14.9451.611653.1
Ruby2JIT16.7250.2321.0
Ruby216.7450.2421.1
Ruby320.8650.2423.0
Ruby3JIT21.5650.4924.0
Python3MYPYC23.2652.4616.7
Python3Nuitka33.2533.8719.3
Python233.6130.2515.0
Python337.5230.2316.8
Ruby2Rbx> 12000.38797.9

matmul

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
C0.2350.2816.6
Python3Codon0.2554.6157.1
Crystal0.25510.4228.2
JavascriptNode0.2650.298.4
LuaJIT0.2750.1856.9
JavascriptGraalVM_JVM0.352.14772.4
Python2PYPY0.3550.2679.9
Python3PYPY0.3650.2482.0
Python3Cython0.3951.1784.5
JavascriptGraalVM0.5150.47397.1
Python3GraalVM_JVM1.453.431301.4
Ruby2GraalVM_JVM1.4751.843035.5
Ruby2GraalVM1.6950.27911.4
Ruby2Topaz1.8350.2189.2
Python3GraalVM2.2650.41024.2
Lua6.1850.1686.7
Ruby3JIT11.8451.070.7
Ruby218.3940.2566.2
Ruby2JRuby_InDy18.932.11042.3
Ruby2JIT20.8630.6766.5
Ruby320.8830.2868.2
Python222.4730.1721.9
Python322.7330.2825.1
Python3Nuitka23.833.8126.8
Python3MYPYC24.9532.5525.3
Ruby2JRuby27.121.63868.3
Python2Jython28.0921.34572.3
Ruby2Rbx> 8000.34719.9

nbody

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Python3MYPYC0.013.15-
Python3Cython0.5650.838.1
C0.5650.251.2
Crystal0.77510.562.7
JavascriptNode0.8250.2847.3
Ruby2GraalVM_JVM0.8551.79886.7
Ruby2GraalVM0.8750.18425.0
LuaJIT1.4450.232.4
Python3Codon2.2355.6712.3
Python3GraalVM_JVM3.1953.051112.5
Python3GraalVM3.8550.32594.2
Python2PYPY4.3950.2562.4
Python3PYPY4.4410.2659.4
JavascriptGraalVM4.8250.53464.4
Ruby2Topaz5.4250.2133.8
JavascriptGraalVM_JVM5.5952.181163.0
PHPJIT7.050.715.8
Ruby2JRuby_InDy14.8552.21783.7
Lua19.6940.232.4
PHP21.7730.211.9
Ruby3JIT33.2920.9626.4
Ruby2JIT36.7720.7621.1
Ruby243.5610.2721.0
Ruby349.9210.2622.8
Ruby2JRuby51.3211.78939.8
Python353.7210.28.6
Python255.8710.19286.5
Python2Jython64.2411.34801.3
Python3Nuitka66.2613.9410.9
Ruby2Rbx> 8000.36615.0

pidigits

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
PHPJIT1.5750.217.7
C1.6150.325.6
PHP1.7150.2213.7
Python3Cython1.7350.9611.7
JavascriptNode2.0750.2252.0
JavascriptGraalVM3.0750.55336.5
JavascriptGraalVM_JVM3.7452.21806.7
Crystal5.22510.597.3
Python36.1750.219.8
Python3MYPYC6.252.369.4
Python26.5150.217.6
Python3Nuitka6.7753.7812.2
Ruby2GraalVM_JVM7.7751.971647.3
Ruby2Topaz7.7850.2135.0
Ruby2JRuby7.9451.561845.2
Ruby2JRuby_InDy7.9551.651285.1
Python2PYPY8.1150.2665.8
Python3PYPY8.2250.2363.2
Python2Jython8.9351.29638.3
Python3GraalVM_JVM9.7853.371628.6
Ruby3JIT10.5350.45124.7
Ruby310.6450.23119.6
Ruby2GraalVM10.7650.21445.2
Ruby2JIT11.350.22171.6
Ruby211.4250.29168.6
Python3GraalVM15.0540.32694.0
Ruby2Rbx22.8130.3488.8
Python3Codon-00.1-

regexdna

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Crystal0.34110.42142.6
JavascriptNode1.0610.64622.4
PHPJIT1.3910.1984.0
PHP1.410.1978.8
Python2PYPY2.3110.33324.2
Python3PYPY2.3810.4267.4
Ruby2Topaz3.110.68298.9
Python35.211.07160.9
Python3MYPYC5.213.23151.5
Ruby2GraalVM_JVM5.3112.822513.4
Python25.4411.05135.3
C5.610.486.7
Python3Cython6.111.73168.2
Python3Nuitka6.214.66150.6
Ruby26.2510.37112.5
Ruby2JIT6.2610.39113.8
JavascriptGraalVM_JVM6.6814.82159.6
Ruby37.4610.45113.8
Ruby3JIT7.510.62115.2
Python2Jython8.4812.35772.2
Lua8.9410.71247.3
Python3GraalVM_JVM9.0416.552456.8
Ruby2JRuby_InDy9.4911.85488.3
Ruby2JRuby9.611.75459.6
Ruby2GraalVM9.9911.482641.9
LuaJIT9.9910.87192.6
JavascriptGraalVM10.013.27711.6
Ruby2Rbx11.6911.87396.0
Python3GraalVM12.8414.27988.1
Python3Codon-01.07-

revcomp

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
C0.5410.28123.2
PHPJIT2.0610.21444.2
PHP2.2710.2317.0
Python32.4510.23951.5
Python22.4710.22797.9
Python3Nuitka2.613.73794.3
Python2PYPY2.8910.281298.3
JavascriptNode3.1510.26625.1
LuaJIT3.3310.22309.6
Ruby3JIT3.6410.5168.9
Ruby33.6710.22167.6
Ruby2JIT4.0910.24164.7
Python3PYPY4.1410.191424.9
Ruby24.210.19164.4
Python3GraalVM_JVM4.3612.853180.4
Crystal5.49110.43916.4
JavascriptGraalVM7.2810.561222.1
Ruby2Topaz7.310.22787.5
JavascriptGraalVM_JVM8.3112.061984.3
Lua8.5210.22747.3
Ruby2JRuby_InDy8.7811.52842.1
Ruby2JRuby9.3611.611008.8
Python3GraalVM10.9810.323192.0
Ruby2GraalVM_JVM14.1511.772836.8
Ruby2GraalVM17.4910.211431.4
Python3MYPYC-02.39-
Python2Jython> 6001.27818.0
Ruby2Rbx> 6000.32504.7
Python3Codon-01.03-

spectralnorm

LanguageInterpreterBest T,sRunsCompile T,sMaxMem, Mb
Python3Cython0.1151.0210.3
JavascriptNode0.1150.2247.0
C0.1150.341.1
Crystal0.12510.33.4
LuaJIT0.1250.22.8
JavascriptGraalVM_JVM0.1352.131268.2
JavascriptGraalVM0.1350.48338.9
Ruby2GraalVM_JVM0.2151.75704.6
Ruby2GraalVM0.2350.22362.2
Python3Codon0.5354.6314.7
Python2PYPY0.6150.1762.9
Python3GraalVM_JVM0.6252.891475.4
Python3PYPY0.7150.2160.8
Python3GraalVM0.7350.27842.6
Ruby2Topaz1.4450.2231.9
PHPJIT2.5150.216.0
Lua3.8650.232.6
Ruby2JRuby_InDy4.0951.61429.3
PHP6.4850.1812.5
Ruby3JIT10.1350.4525.1
Ruby2JRuby10.5651.561741.4
Ruby2JIT12.9550.7521.3
Python3MYPYC13.152.498.4
Python214.2850.156.9
Ruby315.2550.223.1
Ruby217.1840.2521.2
Python3Nuitka19.3943.7311.1
Python320.6930.278.8
Python2Jython40.9811.26372.8
Ruby2Rbx> 8000.36624.6

Versions

LanguageVersion
c12.2.0
crystal1.7.2
cython0.29.30
graalnode22.3.1 (node: 16.18.1)
graalpython22.3.1 (python: 3.8.5)
javaopenjdk 19.0.1
jruby9.4.1.0
jython2.7.3
lua5.4.4
luajit2.1.0-beta3
mypyc1.0.1
nodejs19.7.0
nuitka1.4.8 (python: 3.10.7, gcc: 12.2.0)
php8.2.3
pypy27.3.11 (python: 2.7.18, gcc: 10.2.1)
pypy37.3.11 (python: 3.9.16, gcc: 10.2.1)
python22.7.18
python33.10.7
rbx5.0
ruby22.7.7p221
ruby33.2.1p31
topazhttps://github.com/kostya/topaz
truffleruby22.3.1 (ruby: 3.0.3)
codon0.15.5

Run

Currently possible to run on x86_64 and aarch64. Tested Ubuntu x86_64 and Apple M1.

Install docker-compose-plugin v2 and Ruby, on your local machine.

Run control script for more info:

	./dc

Example build and run binarytrees benchmark for ruby and crystal:

	./dc init crystal,ruby
	./dc up crystal,ruby
	./dc versions crystal,ruby
	./dc build binarytrees crystal,ruby
	./dc check binarytrees crystal,ruby
	./dc run binarytrees crystal,ruby
	./dc down
	./dc readme binarytrees crystal,ruby

Add new language XXX

Create file docker/XXX and add it to docker-compose.yml. Add language XXX into tools/languages.rb. Check that its intalled ok ./dc init XXX.

Create benchmark file: BENCH/test.EXT (BENCH is specific benchmark name, EXT language extension)

To work in benchmark suite, required some special marks in the benchmark file:

Check that it worked.

./dc up XXX
./dc versions XXX
./dc shell XXX
./dc build BENCH XXX
./dc check BENCH XXX
./dc run BENCH XXX