Haxe VS Python benchmarks

Current benchmark data was generated on Mon Dec 30 2024, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1166ms 9.2ms 95.7MB 1100ms 50ms pypy 3.10.14
haxe 1.hx 1335ms 42ms 145.9MB 1523ms 70ms haxe/cpp 4.3.6
haxe 2.hx 4428ms 63ms 497.1MB 5017ms 250ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 50.6MB 5383ms 433ms haxe/hl/c 4.3.6
haxe 2.hx timeout 0.0ms 85.0MB 4953ms 717ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 53.1MB 7477ms 390ms haxe/hl/jit 1.14.0
haxe 2.hx timeout 0.0ms 132.9MB 7453ms 820ms haxe/hl/jit 1.14.0
python 1.py timeout 0.0ms 40.9MB 4967ms 17ms cpython 3.13.1
python 1.py timeout 0.0ms 40.5MB 4760ms 223ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 86ms 1.8ms 27.6MB 70ms 10ms haxe/cpp 4.3.6
python 1.py 96ms 2.2ms 67.9MB 63ms 20ms pypy 3.10.14
haxe 2.hx 388ms 6.7ms 58.3MB 420ms 23ms haxe/cpp 4.3.6
python 1.py 474ms 5.7ms 11.9MB 450ms 7ms pyston 3.8.12
haxe 1.hx 628ms 2.2ms 10.9MB 583ms 60ms haxe/hl/c 4.3.6
haxe 1.hx 666ms 4.0ms 13.2MB 727ms 43ms haxe/hl/jit 1.14.0
python 1.py 709ms 7.3ms 12.6MB 697ms 0ms cpython 3.13.1
haxe 2.hx 915ms 13ms 15.5MB 837ms 127ms haxe/hl/c 4.3.6
haxe 2.hx 953ms 19ms 27.2MB 893ms 183ms haxe/hl/jit 1.14.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 1896ms 11ms 88.3MB 1847ms 33ms pypy 3.10.14
haxe 1.hx 2430ms 12ms 27.6MB 2263ms 247ms haxe/cpp 4.3.6
python 5-m.py 2474ms 26ms 12.5MB 3627ms 973ms pyston 3.8.12
python 5-m.py 2831ms 4.6ms 64.9MB 4040ms 807ms pypy 3.10.14
python 1.py 2999ms 24ms 8.1MB 2983ms 0ms pyston 3.8.12
python 5-m.py 3390ms 14ms 13.9MB 4597ms 887ms cpython 3.13.1
python 1.py 4550ms 39ms 8.6MB 4537ms 0ms cpython 3.13.1
haxe 1.hx timeout 0.0ms 5.2MB 4253ms 950ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 5.7MB 4350ms 877ms haxe/hl/jit 1.14.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 1.py 252ms 5.8ms 63.5MB 227ms 17ms pypy 3.10.14
haxe 1.hx 258ms 1.6ms 25.5MB 223ms 30ms haxe/cpp 4.3.6
python 1.py 310ms 1.9ms 8.1MB 297ms 0ms pyston 3.8.12
python 5-m.py 311ms 4.2ms 12.5MB 410ms 137ms pyston 3.8.12
python 5-m.py 397ms 2.8ms 13.8MB 483ms 127ms cpython 3.13.1
python 1.py 494ms 18ms 8.6MB 480ms 0ms cpython 3.13.1
python 5-m.py 539ms 0.3ms 65.0MB 810ms 283ms pypy 3.10.14
haxe 1.hx 651ms 2.0ms 5.4MB 543ms 123ms haxe/hl/c 4.3.6
haxe 1.hx 690ms 5.2ms 5.7MB 577ms 127ms haxe/hl/jit 1.14.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 2.2ms 0.2ms 4.9MB 0ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 2.3ms 0.2ms 4.4MB 0ms 0ms haxe/cpp 4.3.6
haxe 1.hx 3.8ms 0.4ms 5.3MB 0ms 0ms haxe/hl/jit 1.14.0
python 1.py 11ms 1.0ms 7.6MB 0ms 0ms pyston 3.8.12
python 1.py 13ms 1.3ms 8.6MB 10ms 0ms cpython 3.13.1
python 1.py 28ms 0.7ms 51.0MB 10ms 8ms pypy 3.10.14

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 132ms 0.1ms 20.5MB 117ms 3ms haxe/cpp 4.3.6
haxe 1.hx 135ms 2.0ms 5.2MB 123ms 0ms haxe/hl/c 4.3.6
python 2.py 147ms 1.4ms 57.9MB 123ms 10ms pypy 3.10.14
haxe 1.hx 157ms 2.0ms 5.8MB 147ms 0ms haxe/hl/jit 1.14.0
python 1.py 178ms 5.0ms 59.5MB 153ms 10ms pypy 3.10.14
python 1.py 726ms 18ms 8.9MB 713ms 0ms pyston 3.8.12
python 2.py 833ms 14ms 8.5MB 827ms 0ms pyston 3.8.12
python 1.py 1123ms 16ms 9.4MB 1113ms 0ms cpython 3.13.1
python 2.py 1312ms 12ms 9.0MB 1300ms 0ms cpython 3.13.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
python 2.py 345ms 7.5ms 58.9MB 317ms 13ms pypy 3.10.14
python 1.py 374ms 2.4ms 60.4MB 347ms 10ms pypy 3.10.14
haxe 1.hx 374ms 2.7ms 25.5MB 363ms 0ms haxe/cpp 4.3.6
haxe 1.hx 394ms 2.7ms 5.0MB 377ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 455ms 3.5ms 5.8MB 440ms 3ms haxe/hl/jit 1.14.0
python 1.py 2112ms 9.0ms 8.9MB 2097ms 0ms pyston 3.8.12
python 2.py 2470ms 27ms 8.5MB 2453ms 0ms pyston 3.8.12
python 1.py 3297ms 22ms 9.4MB 3280ms 0ms cpython 3.13.1
python 2.py 3873ms 38ms 9.0MB 3857ms 3ms cpython 3.13.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 63ms 1.4ms 12.4MB 53ms 0ms haxe/cpp 4.3.6
haxe 1.hx 68ms 1.0ms 5.1MB 60ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 79ms 1.9ms 5.7MB 67ms 0ms haxe/hl/jit 1.14.0
python 2.py 104ms 2.3ms 57.8MB 77ms 10ms pypy 3.10.14
python 1.py 119ms 0.8ms 58.5MB 90ms 13ms pypy 3.10.14
python 1.py 342ms 1.9ms 8.5MB 330ms 0ms pyston 3.8.12
python 2.py 384ms 1.2ms 8.1MB 370ms 0ms pyston 3.8.12
python 1.py 527ms 8.2ms 9.0MB 510ms 0ms cpython 3.13.1
python 2.py 638ms 14ms 8.6MB 623ms 0ms cpython 3.13.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 881ms 7.2ms 96.9MB 980ms 40ms haxe/cpp 4.3.6
python 1.py 2228ms 12ms 210.0MB 2107ms 107ms pypy 3.10.14
haxe 1.hx timeout 0.0ms 34.6MB 4763ms 560ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 59.7MB 6013ms 470ms haxe/hl/jit 1.14.0
python 1.py timeout 0.0ms 93.9MB 4957ms 30ms cpython 3.13.1
python 1.py timeout 0.0ms 130.4MB 4930ms 50ms pyston 3.8.12

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 162ms 1.4ms 26.6MB 163ms 3ms haxe/cpp 4.3.6
python 1.py 381ms 4.2ms 103.6MB 330ms 37ms pypy 3.10.14
haxe 1.hx 1282ms 5.4ms 12.7MB 1217ms 137ms haxe/hl/c 4.3.6
haxe 1.hx 1301ms 8.1ms 22.3MB 1310ms 130ms haxe/hl/jit 1.14.0
python 1.py 2924ms 26ms 36.9MB 2890ms 20ms cpython 3.13.1
python 1.py timeout 0.0ms 48.8MB 4940ms 40ms pyston 3.8.12

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 853ms 4.3ms 5.0MB 843ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 1056ms 20ms 5.0MB 1047ms 0ms haxe/hl/c 4.3.6
python 2.py 1353ms 12ms 59.9MB 1337ms 3ms pypy 3.10.14
haxe 3.hx 1383ms 5.0ms 27.5MB 1513ms 37ms haxe/cpp 4.3.6
haxe 2.hx 2402ms 1.6ms 5.8MB 2390ms 0ms haxe/hl/jit 1.14.0
haxe 1.hx 2449ms 4.0ms 5.8MB 2437ms 0ms haxe/hl/jit 1.14.0
python 1.py 2633ms 14ms 56.6MB 2607ms 13ms pypy 3.10.14
haxe 1.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 2.hx timeout 0.0ms 4.4MB 4990ms 0ms haxe/cpp 4.3.6
haxe 3.hx timeout 0.0ms 5.3MB 3917ms 1587ms haxe/hl/c 4.3.6
haxe 3.hx timeout 0.0ms 6.0MB 4130ms 1333ms haxe/hl/jit 1.14.0
python 1.py timeout 0.0ms 8.6MB 4990ms 0ms cpython 3.13.1
python 2.py timeout 0.0ms 8.8MB 4987ms 0ms cpython 3.13.1
python 1.py timeout 0.0ms 8.3MB 4983ms 0ms pyston 3.8.12
python 2.py timeout 0.0ms 8.1MB 4983ms 0ms pyston 3.8.12

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 89ms 1.1ms 5.0MB 80ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 109ms 1.4ms 5.0MB 100ms 0ms haxe/hl/c 4.3.6
haxe 3.hx 153ms 1.0ms 25.6MB 147ms 13ms haxe/cpp 4.3.6
python 2.py 177ms 3.9ms 57.6MB 153ms 10ms pypy 3.10.14
haxe 2.hx 244ms 0.6ms 5.8MB 230ms 0ms haxe/hl/jit 1.14.0
haxe 1.hx 251ms 2.9ms 5.7MB 240ms 0ms haxe/hl/jit 1.14.0
python 1.py 305ms 2.4ms 56.6MB 283ms 7ms pypy 3.10.14
haxe 3.hx 662ms 6.0ms 5.3MB 483ms 237ms haxe/hl/c 4.3.6
haxe 2.hx 675ms 7.4ms 4.4MB 663ms 0ms haxe/cpp 4.3.6
haxe 3.hx 772ms 2.9ms 5.8MB 617ms 210ms haxe/hl/jit 1.14.0
haxe 1.hx 805ms 6.0ms 4.4MB 793ms 0ms haxe/cpp 4.3.6
python 1.py 946ms 19ms 8.3MB 937ms 0ms pyston 3.8.12
python 2.py 1298ms 20ms 8.1MB 1280ms 0ms pyston 3.8.12
python 1.py 2997ms 82ms 8.8MB 2987ms 0ms cpython 3.13.1
python 2.py 3190ms 235ms 8.8MB 3177ms 0ms cpython 3.13.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 3909ms 15ms 5.3MB 3897ms 0ms haxe/hl/c 4.3.6
haxe 1.hx timeout 0.0ms 6.9MB 4990ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 5.8MB 4990ms 0ms haxe/hl/jit 1.14.0
python 8.py timeout 0.0ms 16.7MB 57ms 7ms cpython 3.13.1
python 8.py timeout 0.0ms 100.1MB 863ms 163ms pypy 3.10.14
python 8.py timeout 0.0ms 18.1MB 73ms 20ms pyston 3.8.12

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 985ms 4.9ms 5.1MB 970ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 2388ms 1.9ms 6.5MB 2380ms 0ms haxe/cpp 4.3.6
haxe 1.hx timeout 0.0ms 5.7MB 4990ms 0ms haxe/hl/jit 1.14.0
python 8.py timeout 0.0ms 16.5MB 103ms 17ms cpython 3.13.1
python 8.py timeout 0.0ms 100.0MB 1510ms 497ms pypy 3.10.14
python 8.py timeout 0.0ms 17.8MB 127ms 43ms pyston 3.8.12

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 251ms 2.3ms 5.0MB 240ms 0ms haxe/hl/c 4.3.6
haxe 1.hx 602ms 1.2ms 5.3MB 590ms 0ms haxe/cpp 4.3.6
python 8-m.py 1991ms 11ms 95.1MB 6310ms 350ms pypy 3.10.14
haxe 1.hx 2298ms 16ms 5.8MB 2287ms 0ms haxe/hl/jit 1.14.0
python 8.py timeout 0.0ms 16.1MB 257ms 50ms cpython 3.13.1
python 8.py timeout 0.0ms 17.2MB 433ms 100ms pyston 3.8.12