Java VS Odin benchmarks

Current benchmark data was generated on Sat Jan 28 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -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 665ms 6.1ms 412.0MB 690ms 70ms openjdk 20
java 2.java 719ms 58ms 602.2MB 703ms 117ms openjdk 19
java 2.java 760ms 59ms 667.2MB 823ms 147ms graal/jvm 17.0.6
java 2.java 1276ms 25ms 1068.3MB 903ms 577ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 167ms 1.7ms 109.0MB 167ms 30ms openjdk 19
java 2.java 169ms 16ms 108.4MB 163ms 20ms openjdk 20
java 2-m.java 172ms 3.9ms 157.8MB 217ms 43ms graal/jvm 17.0.6
java 2.java 295ms 1.6ms 248.7MB 197ms 137ms openjdk/zgc 19

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 778ms 13ms 204.8MB 1363ms 63ms openjdk 20
java 1-m.java 846ms 64ms 301.8MB 1367ms 70ms graal/jvm 17.0.6
java 1-m.java 877ms 15ms 199.6MB 1570ms 57ms openjdk 19
java 1-m.java 1013ms 13ms 429.1MB 1507ms 290ms openjdk/zgc 19

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 367ms 12ms 159.9MB 603ms 50ms graal/jvm 17.0.6
java 1-m.java 441ms 18ms 118.0MB 737ms 23ms openjdk 19
java 1-m.java 466ms 5.9ms 115.5MB 780ms 40ms openjdk 20
java 1-m.java 550ms 40ms 209.2MB 790ms 137ms openjdk/zgc 19

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 1668ms 10ms 95.1MB 3183ms 20ms graal/jvm 17.0.6
java 1-m.java 1741ms 6.4ms 43.8MB 3257ms 50ms openjdk/zgc 19
java 1-m.java 1751ms 36ms 43.7MB 3357ms 20ms openjdk 19
java 1-m.java 1789ms 119ms 41.1MB 3427ms 10ms openjdk 20

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 277ms 4.7ms 43.6MB 440ms 20ms openjdk 19
java 1-m.java 278ms 2.5ms 40.5MB 453ms 7ms openjdk 20
java 1-m.java 283ms 4.5ms 90.9MB 463ms 10ms graal/jvm 17.0.6
java 1-m.java 321ms 3.3ms 43.8MB 440ms 57ms openjdk/zgc 19

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 515ms 1.8ms 40.7MB 587ms 10ms openjdk 20
java 4.java 523ms 4.9ms 42.2MB 587ms 17ms openjdk 19
java 4.java 561ms 7.1ms 43.3MB 583ms 57ms openjdk/zgc 19
java 4.java 617ms 8.7ms 99.3MB 793ms 30ms graal/jvm 17.0.6

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 151ms 6.6ms 41.0MB 173ms 10ms openjdk 19
java 4.java 155ms 11ms 89.1MB 203ms 17ms graal/jvm 17.0.6
java 4.java 155ms 5.7ms 40.1MB 183ms 7ms openjdk 20
java 4.java 191ms 4.0ms 41.1MB 167ms 50ms openjdk/zgc 19

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 2.0ms 0.7ms 1.7MB 0ms 0ms odin 2023
java 1.java 76ms 6.2ms 63.1MB 70ms 10ms graal/jvm 17.0.6
java 1.java 79ms 3.3ms 39.3MB 74ms 10ms openjdk 20
java 1.java 81ms 3.7ms 41.3MB 76ms 8ms openjdk 19
java 1.java 119ms 4.3ms 39.7MB 76ms 48ms openjdk/zgc 19

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-m.odin 852ms 21ms 46.9MB 1477ms 43ms odin 2023
java 3-m.java 1450ms 24ms 113.3MB 2653ms 33ms openjdk 20
java 3-m.java 1455ms 8.2ms 116.8MB 2667ms 33ms openjdk 19
java 3-m.java 1562ms 78ms 169.4MB 2877ms 47ms graal/jvm 17.0.6
java 3-m.java 1982ms 73ms 174.2MB 3517ms 120ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 173ms 1.9ms 29.8MB 220ms 20ms odin 2023
java 3-m.java 444ms 36ms 87.4MB 730ms 30ms openjdk 20
java 3-m.java 473ms 46ms 96.2MB 803ms 27ms openjdk 19
java 3-m.java 487ms 49ms 139.1MB 790ms 50ms graal/jvm 17.0.6
java 3-m.java 490ms 25ms 96.3MB 743ms 87ms openjdk/zgc 19

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1b.java 1420ms 19ms 48.3MB 1510ms 17ms openjdk 19
java 1b.java 1423ms 14ms 47.0MB 1507ms 20ms openjdk 20
java 1b.java 1456ms 25ms 108.3MB 1617ms 47ms graal/jvm 17.0.6
java 1b.java 1460ms 14ms 48.8MB 1513ms 53ms openjdk/zgc 19
java 1a.java 1533ms 4.6ms 48.4MB 1597ms 20ms openjdk 19
java 1a.java 1544ms 4.9ms 47.5MB 1620ms 13ms openjdk 20
java 1a.java 1566ms 5.9ms 99.4MB 1637ms 40ms graal/jvm 17.0.6
java 1a.java 1580ms 6.9ms 49.3MB 1610ms 53ms openjdk/zgc 19
odin 1.odin 1585ms 2.5ms 4.5MB 1570ms 0ms odin 2023
java 1.java 2007ms 7.7ms 135.6MB 2093ms 30ms graal/jvm 17.0.6
java 1.java 2113ms 8.6ms 208.1MB 2147ms 47ms openjdk 20
java 1.java 2140ms 25ms 190.1MB 2187ms 47ms openjdk 19
java 1.java 2498ms 7.7ms 578.7MB 2253ms 333ms openjdk/zgc 19
java 2.java timeout 0.0ms 526.6MB 5170ms 110ms openjdk 19
java 2.java timeout 0.0ms 575.3MB 5157ms 120ms openjdk 20
java 2.java timeout 0.0ms 1227.2MB 4887ms 573ms openjdk/zgc 19

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 68ms 0.3ms 1.3MB 60ms 0ms odin 2023
java 1b.java 208ms 16ms 43.2MB 277ms 7ms openjdk 20
java 1a.java 219ms 12ms 48.3MB 300ms 13ms openjdk 19
java 1a.java 220ms 16ms 43.6MB 300ms 7ms openjdk 20
java 1.java 224ms 7.6ms 96.8MB 273ms 20ms openjdk 19
java 1a.java 225ms 11ms 92.2MB 287ms 27ms graal/jvm 17.0.6
java 1b.java 226ms 15ms 46.4MB 290ms 13ms openjdk 19
java 1.java 228ms 9.6ms 95.3MB 270ms 20ms openjdk 20
java 1.java 247ms 19ms 124.2MB 343ms 27ms graal/jvm 17.0.6
java 1a.java 252ms 8.5ms 45.1MB 257ms 57ms openjdk/zgc 19
java 1b-m.java 259ms 19ms 98.7MB 390ms 27ms graal/jvm 17.0.6
java 1b.java 264ms 4.2ms 45.4MB 293ms 50ms openjdk/zgc 19
java 1.java 288ms 1.8ms 111.3MB 287ms 77ms openjdk/zgc 19
java 2.java 767ms 32ms 532.3MB 950ms 133ms openjdk 19
java 2.java 769ms 20ms 581.5MB 960ms 113ms openjdk 20
java 2.java 1331ms 80ms 1038.9MB 1020ms 583ms openjdk/zgc 19

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 505ms 22ms 369.4MB 543ms 47ms openjdk 19
java 1.java 534ms 50ms 290.5MB 547ms 53ms openjdk 20
java 1.java 574ms 78ms 352.8MB 723ms 90ms graal/jvm 17.0.6
java 1.java 951ms 43ms 764.9MB 647ms 437ms openjdk/zgc 19

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 216ms 5.7ms 173.4MB 240ms 30ms openjdk 19
java 1.java 234ms 11ms 222.3MB 227ms 57ms openjdk 20
java 1-m.java 270ms 4.6ms 281.7MB 367ms 67ms graal/jvm 17.0.6
java 1.java 432ms 11ms 354.8MB 253ms 223ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-i.odin 529ms 0.2ms 1.2MB 520ms 0ms odin 2023
java 1.java 542ms 2.3ms 88.2MB 563ms 23ms graal/jvm 17.0.6
java 1.java 565ms 6.7ms 40.5MB 563ms 20ms openjdk 20
java 1.java 568ms 4.5ms 44.3MB 573ms 10ms openjdk 19
java 1.java 613ms 5.8ms 41.9MB 580ms 50ms openjdk/zgc 19
java 2.java 1881ms 18ms 552.6MB 1900ms 113ms openjdk 20
java 2.java 1893ms 4.6ms 532.8MB 1910ms 107ms openjdk 19
java 2.java 2574ms 9.2ms 1220.9MB 1993ms 770ms openjdk/zgc 19
odin 1.odin 2890ms 20ms 1.2MB 2877ms 0ms odin 2023

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-i.odin 56ms 2.3ms 1.2MB 50ms 0ms odin 2023
java 1.java 137ms 1.3ms 86.0MB 163ms 23ms graal/jvm 17.0.6
java 1.java 144ms 3.4ms 42.3MB 157ms 10ms openjdk 19
java 1.java 149ms 7.7ms 40.7MB 160ms 10ms openjdk 20
java 1.java 191ms 2.6ms 44.1MB 160ms 50ms openjdk/zgc 19
odin 1.odin 290ms 0.2ms 1.2MB 280ms 0ms odin 2023
java 2.java 414ms 6.8ms 335.1MB 487ms 63ms openjdk 19
java 2.java 416ms 8.0ms 338.5MB 477ms 67ms openjdk 20
java 2.java 701ms 44ms 528.8MB 540ms 313ms openjdk/zgc 19

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 545ms 31ms 40.6MB 520ms 7ms odin 2023
java 1.java 658ms 16ms 85.7MB 683ms 17ms openjdk 19
java 1.java 780ms 41ms 84.9MB 797ms 30ms openjdk 20
java 1.java 906ms 5.7ms 112.0MB 847ms 80ms openjdk/zgc 19
java 2.java 1003ms 6.2ms 50.6MB 1043ms 13ms openjdk 20
java 2.java 1017ms 5.7ms 54.0MB 1050ms 7ms openjdk 19
java 2.java 1027ms 2.0ms 50.5MB 1007ms 57ms openjdk/zgc 19
java 1-m.java 1131ms 52ms 244.6MB 1700ms 87ms graal/jvm 17.0.6
odin 2.odin 1176ms 2.5ms 6.4MB 1163ms 0ms odin 2023
java 2-m.java 1840ms 116ms 286.4MB 3240ms 110ms graal/jvm 17.0.6

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 119ms 0.9ms 11.3MB 110ms 0ms odin 2023
java 1.java 236ms 3.3ms 61.7MB 253ms 23ms openjdk 19
java 1.java 239ms 7.2ms 58.4MB 260ms 13ms openjdk 20
java 1.java 284ms 2.1ms 60.7MB 260ms 60ms openjdk/zgc 19
odin 2.odin 289ms 3.1ms 2.7MB 277ms 0ms odin 2023
java 2.java 327ms 2.5ms 45.1MB 360ms 10ms openjdk 20
java 2.java 328ms 1.3ms 49.7MB 350ms 17ms openjdk 19
java 1-m.java 338ms 2.6ms 149.3MB 483ms 40ms graal/jvm 17.0.6
java 2.java 359ms 6.6ms 43.9MB 343ms 50ms openjdk/zgc 19
java 2-m.java 614ms 3.5ms 152.0MB 1087ms 47ms graal/jvm 17.0.6

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 4919ms 11ms 360.4MB 5340ms 87ms graal/jvm 17.0.6
java 1.java timeout 0.0ms 239.2MB 5423ms 90ms openjdk 19
java 1.java timeout 0.0ms 279.2MB 5390ms 80ms openjdk 20
java 1.java timeout 0.0ms 1254.0MB 5003ms 670ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 1341ms 31ms 311.6MB 1660ms 80ms graal/jvm 17.0.6
java 1.java 1424ms 19ms 274.6MB 1790ms 63ms openjdk 19
java 1.java 1452ms 11ms 294.2MB 1840ms 70ms openjdk 20
java 1.java 1943ms 14ms 917.6MB 1850ms 570ms openjdk/zgc 19

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3.java timeout 0.0ms 251.6MB 5297ms 53ms graal/jvm 17.0.6
java 3.java timeout 0.0ms 205.8MB 5240ms 70ms openjdk 19
java 3.java timeout 0.0ms 204.2MB 5250ms 63ms openjdk 20
java 3.java timeout 0.0ms 337.4MB 4960ms 220ms openjdk/zgc 19

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 3.java 1031ms 22ms 171.4MB 1417ms 47ms graal/jvm 17.0.6
java 3.java 1061ms 34ms 109.9MB 1380ms 37ms openjdk 19
java 3.java 1064ms 6.8ms 114.5MB 1403ms 27ms openjdk 20
java 3.java 1191ms 24ms 157.7MB 1353ms 120ms openjdk/zgc 19

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 4207ms 116ms 89.8MB 8140ms 20ms graal/jvm 17.0.6
odin 1.odin 4615ms 1.6ms 2.7MB 4603ms 0ms odin 2023
java 2.java timeout 0.0ms 46.0MB 9730ms 17ms openjdk 19
java 2.java timeout 0.0ms 40.7MB 9717ms 13ms openjdk 20
java 2.java timeout 0.0ms 41.8MB 9627ms 43ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1156ms 0.1ms 2.1MB 1143ms 0ms odin 2023
java 2-m.java 1208ms 43ms 91.2MB 2237ms 27ms graal/jvm 17.0.6
java 2-m.java 1621ms 30ms 44.3MB 3063ms 17ms openjdk 19
java 2-m.java 1721ms 70ms 40.9MB 3273ms 10ms openjdk 20
java 2-m.java 1769ms 188ms 42.1MB 3277ms 53ms openjdk/zgc 19

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 291ms 0.1ms 1.8MB 280ms 0ms odin 2023
java 2-m.java 435ms 21ms 89.1MB 727ms 33ms graal/jvm 17.0.6
java 2-m.java 552ms 40ms 41.0MB 977ms 13ms openjdk 20
java 2-m.java 589ms 38ms 44.3MB 1043ms 10ms openjdk 19
java 2-m.java 636ms 31ms 43.9MB 1040ms 57ms openjdk/zgc 19

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 1079ms 1868ms 169.2MB 8467ms 113ms openjdk 19
java 1-m.java 4163ms 65ms 906.7MB 7423ms 537ms openjdk/zgc 19
java 1.java timeout 0.0ms 139.7MB 9567ms 47ms openjdk 20

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 766ms 114ms 112.0MB 1377ms 37ms openjdk 20
java 1-m.java 817ms 154ms 113.2MB 1453ms 47ms openjdk 19
java 1-m.java 950ms 24ms 315.6MB 1520ms 173ms openjdk/zgc 19