Perl VS Java benchmarks

Current benchmark data was generated on Sun Jan 29 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 13ms 411.6MB 690ms 77ms openjdk 20
java 2.java 706ms 38ms 602.6MB 703ms 100ms openjdk 19
java 2.java 758ms 74ms 666.2MB 807ms 170ms graal/jvm 17.0.6
java 2.java 1295ms 55ms 1100.1MB 897ms 600ms openjdk/zgc 19
perl 1.pl timeout 0.0ms 77.7MB 4963ms 17ms perl 5.36.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 166ms 1.5ms 166.6MB 200ms 53ms graal/jvm 17.0.6
java 2.java 169ms 16ms 108.1MB 167ms 23ms openjdk 20
java 2.java 175ms 15ms 110.8MB 190ms 13ms openjdk 19
java 2.java 305ms 2.4ms 237.9MB 167ms 160ms openjdk/zgc 19
perl 1.pl 2232ms 31ms 14.1MB 2213ms 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 517ms 6.4ms 40.5MB 580ms 17ms openjdk 20
java 4.java 520ms 2.8ms 43.5MB 600ms 7ms openjdk 19
java 4.java 561ms 7.6ms 41.9MB 587ms 53ms openjdk/zgc 19
java 4.java 633ms 35ms 97.1MB 800ms 20ms graal/jvm 17.0.6
perl 1.pl 4617ms 201ms 10.9MB 4607ms 0ms perl 5.36.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 4.java 147ms 6.6ms 41.1MB 170ms 10ms openjdk 19
java 4.java 151ms 6.2ms 86.0MB 173ms 20ms graal/jvm 17.0.6
java 4.java 153ms 4.2ms 39.7MB 177ms 7ms openjdk 20
java 4.java 198ms 6.1ms 41.3MB 180ms 43ms openjdk/zgc 19
perl 1.pl 471ms 8.6ms 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 4.8ms 0.1ms 4.0MB 0ms 0ms perl 5.36.0
java 1.java 73ms 5.0ms 69.5MB 72ms 10ms graal/jvm 17.0.6
java 1.java 79ms 5.0ms 39.2MB 72ms 10ms openjdk 20
java 1.java 81ms 6.4ms 41.7MB 80ms 4ms openjdk 19
java 1.java 118ms 0.9ms 40.0MB 76ms 48ms openjdk/zgc 19

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 552ms 11ms 91.5MB 587ms 23ms graal/jvm 17.0.6
java 1.java 568ms 4.1ms 41.7MB 570ms 20ms openjdk 20
java 1.java 569ms 3.5ms 42.5MB 583ms 13ms openjdk 19
java 1.java 613ms 4.2ms 41.7MB 590ms 43ms openjdk/zgc 19
java 2.java 1893ms 20ms 560.5MB 1923ms 103ms openjdk 20
java 2.java 1917ms 37ms 504.3MB 1953ms 110ms openjdk 19
java 2.java 2583ms 5.9ms 1215.9MB 2013ms 753ms openjdk/zgc 19
perl 2.pl timeout 0.0ms 6.4MB 4987ms 0ms perl 5.36.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 141ms 2.6ms 88.3MB 177ms 20ms graal/jvm 17.0.6
java 1.java 150ms 5.2ms 40.8MB 160ms 7ms openjdk 20
java 1.java 151ms 5.1ms 42.6MB 167ms 10ms openjdk 19
java 1.java 188ms 3.2ms 44.0MB 160ms 47ms openjdk/zgc 19
java 2.java 416ms 24ms 323.9MB 487ms 63ms openjdk 19
java 2.java 423ms 14ms 292.4MB 500ms 60ms openjdk 20
java 2.java 710ms 38ms 521.9MB 533ms 323ms openjdk/zgc 19
perl 2.pl 3264ms 72ms 6.3MB 3247ms 3ms 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 4292ms 31ms 91.3MB 8270ms 37ms graal/jvm 17.0.6
java 2.java timeout 0.0ms 43.8MB 9717ms 17ms openjdk 19
java 2.java timeout 0.0ms 40.4MB 9713ms 13ms openjdk 20
java 2.java timeout 0.0ms 43.7MB 9647ms 43ms openjdk/zgc 19
perl 4.pl timeout 0.0ms 8.1MB 9860ms 7ms perl 5.36.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 1230ms 14ms 92.6MB 2260ms 30ms graal/jvm 17.0.6
java 2-m.java 1659ms 48ms 42.4MB 3133ms 10ms openjdk 19
java 2-m.java 1774ms 175ms 43.5MB 3273ms 53ms openjdk/zgc 19
java 2-m.java 1973ms 14ms 40.9MB 3773ms 10ms openjdk 20
perl 4.pl timeout 0.0ms 9.5MB 9720ms 3ms perl 5.36.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2-m.java 432ms 15ms 91.2MB 733ms 20ms graal/jvm 17.0.6
java 2-m.java 579ms 39ms 42.3MB 1013ms 13ms openjdk 19
java 2-m.java 580ms 26ms 40.9MB 1030ms 13ms openjdk 20
java 2-m.java 626ms 51ms 43.4MB 1030ms 50ms openjdk/zgc 19
perl 4.pl timeout 0.0ms 8.4MB 9707ms 3ms perl 5.36.0