The Computer Language
22.01 Benchmarks Game

PHP versus Java fastest programs

Always look at the source code. These are only the fastest programs.

If they are manually vectorized SIMD, does the host language matter? You might not be interested in the most optimised programs.

Look at "mandelbrot" or "spectral-norm" or other measurement tables. Look at the other programs. Choose which programs you want to compare.

regex-redux
source secs mem gz busy cpu load
PHP 1.83 189,236 816 3.65 36% 35% 88% 41%
Java 5.34 862,848 929 17.08 74% 76% 97% 74%
pidigits
source secs mem gz busy cpu load
PHP 0.92 14,236 399 0.93 0% 100% 1% 0%
Java 0.79 36,192 764 0.82 0% 4% 1% 99%
k-nucleotide
source secs mem gz busy cpu load
PHP 19.76 255,072 1079 67.84 96% 76% 96% 76%
Java 4.83 354,148 1812 15.82 87% 83% 81% 76%
reverse-complement
source secs mem gz busy cpu load
PHP 6.96 536,328 446 11.04 48% 6% 32% 73%
Java 1.57 678,512 2183 3.54 48% 59% 44% 75%
spectral-norm
source secs mem gz busy cpu load
PHP 7.03 37,884 1152 27.90 99% 99% 99% 99%
Java 1.55 39,644 756 5.96 98% 96% 97% 95%
fannkuch-redux
source secs mem gz busy cpu load
PHP 57.71 46,568 1162 228.98 100% 99% 99% 99%
Java 10.48 35,264 1282 41.33 98% 99% 99% 98%
mandelbrot
source secs mem gz busy cpu load
PHP 23.26 142,252 875 92.82 100% 100% 100% 100%
Java 4.10 70,448 796 16.11 99% 98% 98% 98%
binary-trees
source secs mem gz busy cpu load
PHP 17.82 1,589,760 760 63.91 89% 89% 96% 84%
Java 2.51 2,479,012 835 7.94 74% 92% 78% 71%
n-body
source secs mem gz busy cpu load
PHP 65.72 12,940 1082 66.13 0% 100% 0% 0%
Java 6.77 35,672 1489 7.02 3% 99% 1% 1%
fasta
source secs mem gz busy cpu load
PHP 20.77 13,076 1062 21.01 1% 0% 0% 100%
Java 1.20 44,952 2543 3.50 79% 63% 78% 71%
PHP

PHP 8.1.1 (cli) (built: Jan 6 2022 19:24:43) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies

Java

openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)