Has anyone tested PHP7 vs Java 8, I was wondering about their performance and how they compare. I was thinking the new virtual machine introduced for PHP was still new or immature compared to Java 8 and its new garbage collector. Not sure about it though
Comparing PHP and Java is apples and oranges. It is hard to get a fair and meaningful comparison.
However, see http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=java&lang2=php. The short answer is that Java 8 is faster than PHP 7. But you should read all of the caveats on the page ... including the fact that language vs language benchmarks are pretty bogus.
For the record, this is what that page currently says (2017-04-23):
Java programs versus PHP
all other Java programs & measurements by benchmark task performance
fasta secs mem gz cpu cpu load Java: 2.13 36,036 2457 5.66 94% 58% 59% 60% PHP: 59.37 8,896 1030 59.36 5% 2% 3% 100% fannkuch-redux secs mem gz cpu cpu load Java: 13.74 30,368 1282 54.12 100% 98% 98% 99% PHP: 280.04 33,588 1150 1,117.48 100% 100% 100% 100% mandelbrot secs mem gz cpu cpu load Java: 7.10 90,588 796 27.92 99% 99% 98% 98% PHP: 125.17 136,776 863 499.16 100% 100% 100% 100% n-body secs mem gz cpu cpu load Java: 21.54 27,092 1489 21.56 1% 1% 100% 1% PHP: 358.21 8,668 1082 358.12 17% 0% 1% 83% spectral-norm secs mem gz cpu cpu load Java: 4.29 29,884 950 16.56 96% 97% 99% 95% PHP: 37.94 19,420 1135 150.67 99% 99% 100% 99% binary-trees secs mem gz cpu cpu load Java: 11.26 593,156 835 39.02 85% 88% 90% 88% PHP: 88.07 736,372 1027 247.49 92% 77% 23% 91% k-nucleotide secs mem gz cpu cpu load Java: 7.93 465,372 1802 25.11 75% 75% 75% 93% PHP: 43.96 235,632 1060 142.28 87% 100% 71% 72% reverse-complement secs mem gz cpu cpu load Java: 1.10 345,352 1661 2.40 33% 82% 53% 54% PHP: 2.81 135,124 426 1.75 31% 21% 44% 57% pidigits secs mem gz cpu cpu load Java: 3.06 31,760 938 3.16 6% 3% 97% 1% PHP: 2.15 9,884 394 2.15 1% 0% 100% 1% regex-redux secs mem gz cpu cpu load Java: 12.31 902,528 929 38.75 73% 76% 86% 81% PHP: 3.34 158,792 786 3.30 25% 26% 22% 92%
Java Version
java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
PHP Version
PHP 7.1.4 (cli) (built: Apr 16 2017 16:17:54) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With