Odin VS Java benchmarks

Current benchmark data was generated on Wed Sep 28 2022, 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.)

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.7ms 0.5ms 1.6MB 0ms 0ms odin 2022
java 1.java 68ms 0.5ms 52.8MB 62ms 10ms graal/jvm 17.0.4
java 1.java 76ms 1.1ms 42.4MB 72ms 10ms openjdk 19
java 1.java 78ms 3.8ms 42.5MB 74ms 4ms openjdk 20
java 1.java 119ms 4.4ms 41.8MB 70ms 54ms openjdk/zgc 19

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 182ms 0.9ms 1.9MB 170ms 0ms odin 2022

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 542ms 0.4ms 1.9MB 530ms 0ms odin 2022

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 86ms 2.6ms 0.9MB 73ms 0ms odin 2022

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 540ms 3.3ms 87.0MB 580ms 17ms graal/jvm 17.0.4
java 1.java 555ms 3.7ms 42.9MB 573ms 7ms openjdk 19
java 1.java 558ms 2.0ms 42.7MB 577ms 7ms openjdk 20
java 1.java 609ms 7.5ms 42.3MB 590ms 57ms openjdk/zgc 19
java 2.java 1878ms 33ms 547.1MB 1903ms 107ms openjdk 19
java 2.java 1906ms 35ms 551.4MB 1943ms 107ms openjdk 20
odin 1.odin 2503ms 2.1ms 0.9MB 2490ms 0ms odin 2022
java 2.java 2586ms 7.0ms 1209.5MB 2020ms 770ms openjdk/zgc 19

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 138ms 3.6ms 42.7MB 150ms 13ms openjdk 20
java 1.java 140ms 0.8ms 87.3MB 180ms 27ms graal/jvm 17.0.4
java 1.java 145ms 2.8ms 44.0MB 163ms 7ms openjdk 19
java 1.java 183ms 0.8ms 41.9MB 160ms 57ms openjdk/zgc 19
odin 1.odin 253ms 0.5ms 0.9MB 243ms 0ms odin 2022
java 2.java 416ms 11ms 351.8MB 473ms 77ms openjdk 19
java 2.java 422ms 14ms 364.2MB 483ms 87ms openjdk 20
java 2.java 678ms 5.7ms 468.7MB 510ms 327ms openjdk/zgc 19

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 629ms 21ms 88.2MB 647ms 30ms openjdk 20
java 1.java 643ms 28ms 84.8MB 677ms 13ms openjdk 19
odin 1.odin 710ms 43ms 40.5MB 687ms 10ms odin 2022
java 1.java 906ms 36ms 110.4MB 863ms 77ms openjdk/zgc 19
java 2.java 1001ms 8.8ms 52.5MB 1033ms 17ms openjdk 20
java 2.java 1026ms 7.8ms 50.9MB 1017ms 53ms openjdk/zgc 19
java 2.java 1053ms 35ms 53.9MB 1090ms 17ms openjdk 19
java 1-m.java 1065ms 57ms 164.7MB 1633ms 50ms graal/jvm 17.0.4
odin 2.odin 1162ms 6.5ms 6.3MB 1147ms 0ms odin 2022
java 2-m.java 1850ms 9.5ms 130.7MB 3400ms 57ms graal/jvm 17.0.4

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 123ms 4.6ms 11.4MB 110ms 0ms odin 2022
java 1.java 226ms 1.1ms 60.4MB 263ms 10ms openjdk 20
java 1.java 228ms 4.7ms 62.2MB 253ms 20ms openjdk 19
java 1.java 280ms 4.5ms 60.8MB 270ms 53ms openjdk/zgc 19
odin 2.odin 284ms 1.6ms 2.9MB 273ms 0ms odin 2022
java 2.java 316ms 2.9ms 48.3MB 343ms 23ms openjdk 20
java 2.java 322ms 4.4ms 48.5MB 357ms 10ms openjdk 19
java 1-m.java 329ms 17ms 135.7MB 470ms 43ms graal/jvm 17.0.4
java 2.java 357ms 1.6ms 44.3MB 347ms 57ms openjdk/zgc 19
java 2-m.java 610ms 5.4ms 127.3MB 1083ms 43ms graal/jvm 17.0.4

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 4295ms 13ms 106.8MB 8300ms 30ms graal/jvm 17.0.4
odin 1.odin 4620ms 1.3ms 2.9MB 4603ms 0ms odin 2022
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 19
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk 20
java 2.java timeout 0.0ms 0.0MB 0ms 0ms openjdk/zgc 19

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1158ms 1.0ms 2.4MB 1150ms 0ms odin 2022
java 2-m.java 1244ms 9.2ms 103.8MB 2293ms 37ms graal/jvm 17.0.4
java 2-m.java 1603ms 59ms 44.5MB 3043ms 17ms openjdk 20
java 2-m.java 1702ms 192ms 46.3MB 3240ms 13ms openjdk 19
java 2-m.java 1784ms 198ms 42.6MB 3310ms 53ms openjdk/zgc 19

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 292ms 0.1ms 1.9MB 277ms 0ms odin 2022
java 2-m.java 431ms 4.5ms 102.8MB 723ms 37ms graal/jvm 17.0.4
java 2-m.java 562ms 23ms 42.3MB 1003ms 17ms openjdk 19
java 2-m.java 594ms 17ms 44.7MB 1067ms 17ms openjdk 20
java 2-m.java 643ms 7.4ms 44.5MB 1073ms 57ms openjdk/zgc 19