Php VS Java benchmarks

Current benchmark data was generated on Wed Jan 22 2025, 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 467ms 1.5ms 646.0MB 567ms 97ms openjdk 23
java 2-m.java 468ms 12ms 645.0MB 687ms 90ms graal/jvm 17.0.8
java 2.java 498ms 2.1ms 572.9MB 563ms 113ms openjdk 21
java 2.java 1170ms 8.1ms 1044.5MB 570ms 760ms openjdk/zgc 21
php 1.php timeout 0.0ms 141.9MB 4957ms 23ms php 8.2.27

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 126ms 6.8ms 96.2MB 147ms 40ms openjdk 23
java 2.java 127ms 1.9ms 168.9MB 160ms 23ms openjdk 21
java 2-m.java 150ms 3.7ms 231.2MB 210ms 67ms graal/jvm 17.0.8
java 2.java 307ms 4.8ms 241.9MB 163ms 197ms openjdk/zgc 21
php 1.php 619ms 7.3ms 62.7MB 590ms 13ms php 8.2.27

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 50ms 1.1ms 52.6MB 22ms 12ms php 8.2.27
java 1.java 64ms 1.6ms 54.9MB 66ms 18ms graal/jvm 17.0.8
java 1.java 71ms 6.1ms 43.9MB 80ms 16ms openjdk 21
java 1.java 72ms 6.3ms 44.7MB 70ms 20ms openjdk 23
java 1.java 186ms 4.8ms 44.6MB 90ms 126ms openjdk/zgc 21

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 397ms 2.9ms 630.4MB 593ms 97ms graal/jvm 17.0.8
java 1.java 401ms 1.0ms 537.3MB 483ms 103ms openjdk 23
java 1.java 401ms 4.9ms 679.9MB 467ms 90ms openjdk 21
java 1.java 1072ms 7.5ms 966.2MB 473ms 723ms openjdk/zgc 21
php 1.php 3744ms 64ms 113.9MB 3703ms 23ms php 8.2.27

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 164ms 3.1ms 207.5MB 237ms 40ms openjdk 21
java 1-m.java 164ms 2.2ms 160.1MB 243ms 37ms openjdk 23
java 1-m.java 207ms 1.6ms 255.6MB 343ms 57ms graal/jvm 17.0.8
java 1.java 432ms 23ms 343.8MB 200ms 307ms openjdk/zgc 21
php 1.php 826ms 9.2ms 67.1MB 787ms 23ms php 8.2.27