Perl VS Java benchmarks

Current benchmark data was generated on Thu Sep 22 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 664ms 1.0ms 413.9MB 690ms 83ms openjdk 20
java 2.java 690ms 43ms 602.5MB 673ms 120ms openjdk 19
java 2.java 744ms 45ms 680.0MB 807ms 163ms graal/jvm 17.0.4
java 2.java 1277ms 28ms 1069.2MB 903ms 583ms openjdk/zgc 19
perl 1.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 164ms 6.4ms 109.4MB 170ms 23ms openjdk 19
java 2.java 174ms 14ms 111.4MB 163ms 37ms openjdk 20
java 2-m.java 182ms 6.2ms 168.4MB 240ms 40ms graal/jvm 17.0.4
java 2.java 300ms 5.7ms 243.7MB 187ms 153ms openjdk/zgc 19
perl 1.pl 2242ms 10ms 14.2MB 2227ms 0ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 510ms 2.3ms 44.0MB 587ms 17ms openjdk 20
java 4.java 515ms 7.4ms 43.3MB 590ms 17ms openjdk 19
java 4.java 558ms 6.8ms 41.8MB 587ms 67ms openjdk/zgc 19
java 4-m.java 618ms 4.2ms 119.8MB 937ms 27ms graal/jvm 17.0.4
perl 1.pl 4465ms 39ms 11.2MB 4450ms 0ms perl 5.36.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 141ms 1.4ms 42.9MB 160ms 20ms openjdk 20
java 4.java 144ms 4.0ms 41.2MB 177ms 7ms openjdk 19
java 4.java 154ms 7.2ms 90.9MB 193ms 23ms graal/jvm 17.0.4
java 4.java 184ms 4.4ms 43.1MB 167ms 50ms openjdk/zgc 19
perl 1.pl 468ms 15ms 6.7MB 457ms 0ms perl 5.36.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 1.pl 3.7ms 2.3ms 5.0MB 0ms 0ms perl 5.36.0
java 1.java 70ms 3.1ms 63.4MB 70ms 10ms graal/jvm 17.0.4
java 1.java 78ms 5.0ms 42.7MB 78ms 6ms openjdk 20
java 1.java 82ms 3.6ms 40.8MB 78ms 8ms openjdk 19
java 1.java 119ms 4.8ms 39.9MB 78ms 52ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 539ms 2.8ms 86.1MB 583ms 20ms graal/jvm 17.0.4
java 1.java 558ms 2.9ms 44.4MB 563ms 23ms openjdk 20
java 1.java 558ms 2.6ms 42.4MB 577ms 13ms openjdk 19
java 1.java 614ms 4.4ms 42.3MB 590ms 57ms openjdk/zgc 19
java 2.java 1887ms 33ms 538.3MB 1923ms 107ms openjdk 19
java 2.java 1923ms 9.6ms 563.7MB 1950ms 127ms openjdk 20
java 2.java 2582ms 4.7ms 1219.4MB 2027ms 753ms openjdk/zgc 19
perl 2.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 142ms 3.9ms 42.7MB 157ms 17ms openjdk 20
java 1.java 144ms 1.6ms 86.4MB 190ms 20ms graal/jvm 17.0.4
java 1.java 146ms 5.8ms 42.7MB 167ms 10ms openjdk 19
java 1.java 190ms 3.5ms 42.2MB 160ms 57ms openjdk/zgc 19
java 2.java 414ms 4.9ms 363.3MB 493ms 70ms openjdk 20
java 2.java 417ms 2.1ms 355.0MB 483ms 73ms openjdk 19
java 2.java 676ms 0.7ms 455.4MB 547ms 290ms openjdk/zgc 19
perl 2.pl 3225ms 26ms 6.4MB 3213ms 0ms perl 5.36.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 4306ms 8.2ms 104.9MB 8330ms 30ms graal/jvm 17.0.4
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
perl 4.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1270ms 5.6ms 108.9MB 2323ms 37ms graal/jvm 17.0.4
java 2-m.java 1647ms 83ms 44.4MB 3100ms 20ms openjdk 19
java 2-m.java 1733ms 180ms 44.2MB 3290ms 17ms openjdk 20
java 2-m.java 1755ms 197ms 42.6MB 3250ms 57ms openjdk/zgc 19
perl 4.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 446ms 11ms 98.3MB 743ms 40ms graal/jvm 17.0.4
java 2-m.java 563ms 42ms 44.2MB 1017ms 10ms openjdk 20
java 2-m.java 582ms 12ms 44.6MB 1037ms 17ms openjdk 19
java 2-m.java 647ms 16ms 44.4MB 1083ms 50ms openjdk/zgc 19
perl 4.pl timeout 0.0ms 0.0MB 0ms 0ms perl 5.36.0