Haxe VS Java 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
java 2.java 470ms 5.2ms 643.8MB 573ms 93ms openjdk 23
java 2-m.java 503ms 33ms 647.1MB 723ms 113ms graal/jvm 17.0.8
java 2.java 523ms 24ms 572.1MB 573ms 123ms openjdk 21
java 2.java 1179ms 21ms 1061.1MB 597ms 750ms openjdk/zgc 21
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

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
java 2.java 121ms 3.7ms 167.1MB 147ms 33ms openjdk 21
java 2.java 127ms 6.0ms 98.3MB 160ms 30ms openjdk 23
java 2-m.java 147ms 3.6ms 217.2MB 217ms 50ms graal/jvm 17.0.8
java 2.java 308ms 0.7ms 241.5MB 150ms 210ms openjdk/zgc 21
haxe 2.hx 388ms 6.7ms 58.3MB 420ms 23ms haxe/cpp 4.3.6
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
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
java 4.java 451ms 5.2ms 47.6MB 530ms 20ms openjdk 21
java 4.java 454ms 3.6ms 49.0MB 547ms 10ms openjdk 23
java 4-m.java 463ms 14ms 105.1MB 660ms 40ms graal/jvm 17.0.8
java 4.java 563ms 2.0ms 46.9MB 530ms 133ms openjdk/zgc 21
haxe 1.hx 2430ms 12ms 27.6MB 2263ms 247ms haxe/cpp 4.3.6
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
java 4.java 125ms 0.4ms 46.8MB 163ms 17ms openjdk 21
java 4.java 125ms 0.6ms 47.6MB 173ms 10ms openjdk 23
java 4-m.java 132ms 11ms 97.1MB 180ms 37ms graal/jvm 17.0.8
java 4.java 238ms 8.8ms 43.8MB 153ms 140ms openjdk/zgc 21
haxe 1.hx 258ms 1.6ms 25.5MB 223ms 30ms haxe/cpp 4.3.6
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
java 1.java 63ms 1.7ms 54.7MB 60ms 22ms graal/jvm 17.0.8
java 1.java 66ms 3.8ms 43.8MB 70ms 18ms openjdk 21
java 1.java 68ms 6.1ms 44.7MB 76ms 12ms openjdk 23
java 1.java 187ms 4.7ms 44.6MB 78ms 132ms openjdk/zgc 21

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
haxe 1.hx 157ms 2.0ms 5.8MB 147ms 0ms haxe/hl/jit 1.14.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
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

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

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 399ms 1.4ms 542.0MB 487ms 93ms openjdk 23
java 1.java 423ms 3.2ms 678.0MB 463ms 120ms openjdk 21
java 1-m.java 432ms 28ms 579.8MB 670ms 87ms graal/jvm 17.0.8
haxe 1.hx 881ms 7.2ms 96.9MB 980ms 40ms haxe/cpp 4.3.6
java 1.java 1051ms 32ms 963.0MB 460ms 717ms openjdk/zgc 21
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

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 161ms 1.6ms 206.3MB 240ms 30ms openjdk 21
java 1-m.java 162ms 2.8ms 158.4MB 233ms 40ms openjdk 23
haxe 1.hx 162ms 1.4ms 26.6MB 163ms 3ms haxe/cpp 4.3.6
java 1-m.java 233ms 27ms 259.4MB 393ms 53ms graal/jvm 17.0.8
java 1.java 416ms 29ms 341.8MB 207ms 283ms openjdk/zgc 21
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

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 440ms 1.4ms 45.1MB 480ms 17ms openjdk 21
java 1.java 442ms 1.9ms 48.1MB 480ms 10ms openjdk 23
java 1.java 448ms 9.7ms 84.8MB 477ms 23ms graal/jvm 17.0.8
java 1.java 564ms 1.4ms 44.6MB 477ms 143ms openjdk/zgc 21
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
java 2.java 1225ms 6.3ms 537.4MB 1353ms 73ms openjdk 21
java 2.java 1260ms 20ms 715.9MB 1367ms 110ms openjdk 23
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
java 2.java 3206ms 52ms 2355.0MB 1643ms 1770ms openjdk/zgc 21
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

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
java 1.java 118ms 1.6ms 45.3MB 157ms 17ms openjdk 21
java 1.java 122ms 0.2ms 48.4MB 160ms 10ms openjdk 23
java 1-m.java 122ms 5.7ms 95.3MB 160ms 30ms graal/jvm 17.0.8
haxe 3.hx 153ms 1.0ms 25.6MB 147ms 13ms haxe/cpp 4.3.6
haxe 2.hx 244ms 0.6ms 5.8MB 230ms 0ms haxe/hl/jit 1.14.0
java 1.java 245ms 1.2ms 44.5MB 160ms 143ms openjdk/zgc 21
haxe 1.hx 251ms 2.9ms 5.7MB 240ms 0ms haxe/hl/jit 1.14.0
java 2-m.java 296ms 5.5ms 346.7MB 430ms 57ms openjdk 21
java 2-m.java 298ms 3.8ms 394.1MB 427ms 70ms openjdk 23
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
java 2.java 682ms 11ms 527.4MB 467ms 393ms openjdk/zgc 21
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

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1954ms 2.3ms 47.6MB 7430ms 27ms openjdk 21
java 2-m.java 1957ms 10.0ms 48.4MB 7443ms 27ms openjdk 23
java 2-m.java 2087ms 15ms 47.8MB 7507ms 150ms openjdk/zgc 21
java 2-m.java 2463ms 18ms 101.0MB 8780ms 43ms graal/jvm 17.0.8
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

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 581ms 3.1ms 48.0MB 2053ms 13ms openjdk 21
java 2-m.java 590ms 3.1ms 48.8MB 2057ms 23ms openjdk 23
java 2-m.java 712ms 6.8ms 47.4MB 2073ms 143ms openjdk/zgc 21
java 2-m.java 730ms 13ms 100.2MB 2463ms 43ms graal/jvm 17.0.8
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

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 235ms 9.8ms 47.9MB 683ms 17ms openjdk 21
java 2-m.java 238ms 3.7ms 48.8MB 667ms 27ms openjdk 23
haxe 1.hx 251ms 2.3ms 5.0MB 240ms 0ms haxe/hl/c 4.3.6
java 2-m.java 282ms 17ms 99.0MB 820ms 43ms graal/jvm 17.0.8
java 2-m.java 360ms 7.4ms 47.0MB 673ms 150ms openjdk/zgc 21
haxe 1.hx 602ms 1.2ms 5.3MB 590ms 0ms haxe/cpp 4.3.6
haxe 1.hx 2298ms 16ms 5.8MB 2287ms 0ms haxe/hl/jit 1.14.0