Odin VS Java benchmarks

Current benchmark data was generated on Sat Nov 16 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 7.7ms 638.0MB 577ms 97ms openjdk 23
java 2.java 471ms 26ms 576.1MB 553ms 93ms openjdk 21
java 2-m.java 471ms 4.1ms 646.9MB 670ms 100ms graal/jvm 17.0.8
java 2.java 1177ms 9.4ms 1047.0MB 560ms 777ms openjdk/zgc 21
odin 1.odin 2340ms 23ms 49.5MB 2310ms 13ms odin 2024

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 121ms 3.3ms 98.0MB 150ms 37ms openjdk 23
java 2.java 123ms 1.3ms 167.1MB 143ms 37ms openjdk 21
java 2-m.java 170ms 4.2ms 230.2MB 260ms 47ms graal/jvm 17.0.8
odin 1.odin 219ms 0.7ms 7.5MB 210ms 0ms odin 2024
java 2.java 309ms 1.6ms 242.5MB 163ms 200ms openjdk/zgc 21

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.2ms 0.1ms 1.6MB 0ms 0ms odin 2024
java 1.java 64ms 3.0ms 58.5MB 62ms 24ms graal/jvm 17.0.8
java 1.java 68ms 5.7ms 44.4MB 68ms 20ms openjdk 23
java 1.java 71ms 3.9ms 43.8MB 72ms 22ms openjdk 21
java 1.java 186ms 3.8ms 44.8MB 76ms 136ms openjdk/zgc 21

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 162ms 12ms 1.6MB 150ms 0ms odin 2024

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 457ms 5.4ms 1.6MB 447ms 0ms odin 2024

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 70ms 1.7ms 1.6MB 63ms 0ms odin 2024

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 284ms 1.0ms 4.6MB 270ms 0ms odin 2024
java 1b.java 1154ms 15ms 54.4MB 1260ms 23ms openjdk 21
java 1b.java 1163ms 14ms 105.3MB 1310ms 43ms graal/jvm 17.0.8
java 1b.java 1171ms 30ms 55.3MB 1293ms 20ms openjdk 23
java 1.java 1247ms 10ms 137.6MB 1370ms 33ms graal/jvm 17.0.8
java 1b.java 1271ms 9.1ms 51.5MB 1260ms 140ms openjdk/zgc 21
java 1a.java 1650ms 7.6ms 55.2MB 1743ms 20ms openjdk 23
java 1a.java 1655ms 3.6ms 55.0MB 1747ms 23ms openjdk 21
java 1a.java 1681ms 13ms 104.5MB 1797ms 40ms graal/jvm 17.0.8
java 1.java 1687ms 5.5ms 202.5MB 1747ms 50ms openjdk 21
java 1.java 1703ms 7.0ms 301.7MB 1767ms 43ms openjdk 23
java 1a.java 1768ms 3.5ms 53.0MB 1737ms 143ms openjdk/zgc 21
java 1.java 2351ms 1.2ms 855.0MB 1790ms 657ms openjdk/zgc 21
java 2.java timeout 0.0ms 696.3MB 5310ms 127ms openjdk 21
java 2.java timeout 0.0ms 744.4MB 5267ms 123ms openjdk 23
java 2.java timeout 0.0ms 3358.5MB 3360ms 2000ms openjdk/zgc 21

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 14ms 0.4ms 1.6MB 10ms 0ms odin 2024
java 1b-m.java 181ms 7.7ms 49.6MB 280ms 23ms openjdk 21
java 1b-m.java 186ms 2.0ms 50.6MB 293ms 17ms openjdk 23
java 1-m.java 187ms 2.3ms 81.8MB 257ms 33ms openjdk 21
java 1a-m.java 189ms 3.6ms 52.2MB 280ms 23ms openjdk 23
java 1a-m.java 189ms 0.3ms 50.1MB 283ms 30ms openjdk 21
java 1-m.java 190ms 3.3ms 114.5MB 283ms 43ms graal/jvm 17.0.8
java 1-m.java 191ms 4.3ms 86.8MB 260ms 33ms openjdk 23
java 1a-m.java 215ms 13ms 102.3MB 320ms 43ms graal/jvm 17.0.8
java 1b-m.java 227ms 19ms 108.0MB 373ms 47ms graal/jvm 17.0.8
java 1b.java 296ms 12ms 47.5MB 277ms 137ms openjdk/zgc 21
java 1a.java 312ms 2.2ms 49.8MB 297ms 137ms openjdk/zgc 21
java 1.java 331ms 6.3ms 116.4MB 257ms 163ms openjdk/zgc 21
java 2-m.java 552ms 12ms 598.8MB 837ms 87ms openjdk 21
java 2-m.java 564ms 13ms 755.5MB 837ms 97ms openjdk 23
java 2.java 1579ms 6.4ms 1347.9MB 837ms 1050ms openjdk/zgc 21

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 353ms 1.7ms 1.5MB 340ms 0ms odin 2024
odin 1-i.odin 355ms 1.2ms 1.5MB 340ms 0ms odin 2024
java 1.java 441ms 0.5ms 44.8MB 473ms 17ms openjdk 21
java 1.java 443ms 0.5ms 48.2MB 473ms 20ms openjdk 23
java 1.java 448ms 4.1ms 87.2MB 477ms 33ms graal/jvm 17.0.8
java 1.java 561ms 5.7ms 44.9MB 477ms 143ms openjdk/zgc 21
java 2.java 1229ms 2.7ms 655.9MB 1363ms 70ms openjdk 21
java 2.java 1235ms 8.6ms 756.2MB 1357ms 87ms openjdk 23
java 2.java 3343ms 165ms 2671.0MB 1647ms 1893ms openjdk/zgc 21

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 37ms 0.5ms 1.5MB 27ms 0ms odin 2024
odin 1-i.odin 38ms 0.6ms 1.5MB 30ms 0ms odin 2024
java 1.java 112ms 4.9ms 45.5MB 147ms 13ms openjdk 21
java 1.java 119ms 3.9ms 47.9MB 147ms 20ms openjdk 23
java 1.java 124ms 8.9ms 87.2MB 153ms 30ms graal/jvm 17.0.8
java 1.java 239ms 6.7ms 46.6MB 147ms 147ms openjdk/zgc 21
java 2-m.java 296ms 11ms 364.7MB 430ms 60ms openjdk 21
java 2-m.java 307ms 7.8ms 389.9MB 443ms 60ms openjdk 23
java 2.java 699ms 7.2ms 532.4MB 463ms 420ms openjdk/zgc 21

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 283ms 4.5ms 40.6MB 263ms 3ms odin 2024
java 1.java 395ms 4.3ms 114.7MB 450ms 10ms openjdk 21
java 1.java 396ms 5.8ms 118.3MB 430ms 27ms openjdk 23
java 1.java 584ms 3.9ms 112.7MB 483ms 167ms openjdk/zgc 21
java 1-m.java 629ms 35ms 236.3MB 907ms 80ms graal/jvm 17.0.8
odin 2.odin 744ms 10ms 6.5MB 733ms 3ms odin 2024
java 2.java 772ms 4.5ms 57.5MB 827ms 13ms openjdk 21
java 2.java 777ms 5.0ms 60.4MB 827ms 20ms openjdk 23
java 2.java 842ms 1.8ms 53.1MB 773ms 140ms openjdk/zgc 21
java 2-m.java 1369ms 54ms 201.6MB 2457ms 100ms graal/jvm 17.0.8

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 59ms 0.9ms 11.4MB 50ms 0ms odin 2024
java 1.java 153ms 3.0ms 68.3MB 190ms 27ms openjdk 23
java 1.java 160ms 6.4ms 64.9MB 213ms 23ms openjdk 21
odin 2.odin 177ms 11ms 2.8MB 167ms 0ms odin 2024
java 1-m.java 234ms 25ms 148.6MB 330ms 50ms graal/jvm 17.0.8
java 2.java 259ms 7.1ms 49.9MB 333ms 7ms openjdk 21
java 2.java 260ms 4.7ms 50.6MB 310ms 17ms openjdk 23
java 1.java 283ms 1.4ms 61.3MB 203ms 150ms openjdk/zgc 21
java 2.java 372ms 8.8ms 47.7MB 300ms 147ms openjdk/zgc 21
java 2-m.java 509ms 70ms 152.0MB 900ms 67ms graal/jvm 17.0.8

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1961ms 4.4ms 47.6MB 7457ms 33ms openjdk 21
java 2-m.java 1968ms 4.8ms 48.4MB 7473ms 27ms openjdk 23
java 2-m.java 2079ms 15ms 45.4MB 7450ms 147ms openjdk/zgc 21
java 2-m.java 2453ms 9.0ms 99.2MB 8760ms 27ms graal/jvm 17.0.8
odin 1.odin 3586ms 7.2ms 2.9MB 3573ms 0ms odin 2024

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 584ms 3.8ms 48.4MB 2047ms 17ms openjdk 23
java 2-m.java 584ms 2.4ms 47.5MB 2050ms 23ms openjdk 21
java 2-m.java 710ms 3.8ms 47.5MB 2070ms 140ms openjdk/zgc 21
java 2-m.java 739ms 5.6ms 96.7MB 2483ms 43ms graal/jvm 17.0.8
odin 1.odin 904ms 9.0ms 2.3MB 893ms 0ms odin 2024

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 227ms 1.7ms 1.9MB 220ms 0ms odin 2024
java 2-m.java 243ms 3.7ms 48.4MB 690ms 17ms openjdk 23
java 2-m.java 252ms 12ms 48.0MB 717ms 23ms openjdk 21
java 2-m.java 281ms 21ms 98.1MB 813ms 33ms graal/jvm 17.0.8
java 2-m.java 358ms 5.7ms 47.1MB 680ms 140ms openjdk/zgc 21