Php VS Java benchmarks

Current benchmark data was generated on Tue Apr 01 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 463ms 0.8ms 576.3MB 547ms 97ms openjdk 21
java 2-m.java 465ms 3.0ms 643.3MB 647ms 120ms graal/jvm 17.0.8
java 2.java 474ms 2.2ms 624.4MB 590ms 93ms openjdk 23
java 2.java 1249ms 22ms 1096.2MB 580ms 837ms openjdk/zgc 21
php 1.php timeout 0.0ms 141.8MB 4963ms 23ms php 8.2.28

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 2.java 126ms 3.1ms 167.2MB 157ms 30ms openjdk 21
java 2-m.java 128ms 4.5ms 98.8MB 163ms 30ms openjdk 23
java 2-m.java 149ms 6.5ms 224.4MB 223ms 57ms graal/jvm 17.0.8
java 2.java 313ms 5.1ms 241.8MB 160ms 210ms openjdk/zgc 21
php 1.php 623ms 2.8ms 63.1MB 587ms 23ms php 8.2.28

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 52ms 1.0ms 52.8MB 20ms 20ms php 8.2.28
java 1.java 64ms 1.4ms 52.8MB 66ms 20ms graal/jvm 17.0.8
java 1.java 68ms 2.2ms 43.7MB 78ms 18ms openjdk 21
java 1.java 73ms 6.0ms 44.7MB 76ms 18ms openjdk 23
java 1.java 195ms 5.0ms 43.0MB 86ms 138ms openjdk/zgc 21

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1.java 403ms 6.5ms 679.3MB 460ms 100ms openjdk 21
java 1.java 404ms 6.2ms 543.6MB 507ms 87ms openjdk 23
java 1-m.java 415ms 10ms 628.4MB 613ms 107ms graal/jvm 17.0.8
java 1.java 1081ms 7.3ms 969.4MB 447ms 757ms openjdk/zgc 21
php 1.php 4055ms 54ms 114.0MB 4010ms 30ms php 8.2.28

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
java 1-m.java 168ms 0.6ms 158.6MB 250ms 40ms openjdk 23
java 1-m.java 170ms 0.4ms 206.2MB 240ms 50ms openjdk 21
java 1-m.java 218ms 17ms 253.4MB 360ms 60ms graal/jvm 17.0.8
java 1.java 426ms 21ms 342.0MB 217ms 290ms openjdk/zgc 21
php 1.php 842ms 8.7ms 67.2MB 803ms 20ms php 8.2.28