3v4l.org

run code in 300+ PHP versions simultaneously
<?php printf("test.php: php %s, phar-api %s\n", PHP_VERSION, PharData::apiVersion()); class Metrics { public $steps = array(); public function emit($what, $usage) { static $prev; static $beat = 0; if ($prev) { $this->steps[$beat] = $usage - $prev; } printf("[%s %05d] %s: %s\n", PHP_VERSION, ++$beat, $what, $prev ? sprintf('%d %+d', $usage, $usage - $prev): $usage); $prev = $usage; } public function tick($what) { $this->emit($what, memory_get_usage()); } public function summary() { $steps = $this->steps; $count = count($steps); $steps[] = null; for ($i = 1; $i < $count;) { $v = $steps[$i]; for ($j = $i + 1; $j <= $count; $j++) { $w = $steps[$j]; if ($w !== $v) { $c = $i === $j - 1 ? 1 : $j - $i; $cc[$v] = (isset($cc[$v]) ? $cc[$v] : 0) + $c; printf( "%-8s %-2s %+d %d\n", 1 === $c ? $i : sprintf('%d-%d', $i, $j - 1), 1 === $c ? '' : $j - $i, $v, $cc[$v] ); $i = $j; break; } } } } } $metrics = new Metrics(); $metrics->tick('start'); function phar_tick() { static $i = 0; $path = sprintf('%s/%d.tar', sys_get_temp_dir(), ++$i); $phar = new PharData($path); $phar->addEmptyDir('test'); $phar->delete('test'); unset($phar); unlink($path); } for ($i = 0; $i < 100; $i++) { phar_tick(); $metrics->tick('after'); } gc_collect_cycles(); $metrics->tick('end'); $metrics->summary();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.0.30.0701.93116.91
8.0.20.0681.92416.94
8.0.10.0521.93817.00
8.0.00.0331.97216.99
7.4.160.0441.94716.54
7.4.150.0331.98916.46
7.4.140.0511.93516.56
7.4.130.0461.96216.36
7.4.120.0521.94816.55
7.4.110.0491.94316.44
7.4.100.0651.90816.53
7.4.90.0431.96316.58
7.4.80.0391.95416.58
7.4.70.0621.92816.46
7.4.60.0401.95816.56
7.4.50.0711.90616.35
7.4.40.0741.89816.45
7.4.30.0811.91316.31
7.4.20.0611.92616.30
7.4.10.0521.94416.39
7.4.00.0551.93516.45
7.3.280.0551.92016.25
7.3.270.0551.93816.35
7.3.260.0421.94216.36
7.3.250.0551.94316.35
7.3.240.0491.94916.29
7.3.230.0511.92616.36
7.3.220.0421.94016.23
7.3.210.0811.91316.26
7.3.200.0331.97916.35
7.3.190.0421.94716.30
7.3.180.0421.95616.28
7.3.170.0711.91016.27
7.3.160.0721.92816.40
7.3.150.0521.94916.29
7.3.140.0391.94616.36
7.3.130.0421.94716.40
7.3.120.0531.95416.34
7.3.110.0521.93516.20
7.3.100.0881.90516.23
7.3.90.0681.94116.45
7.3.80.0611.92016.29
7.3.70.0681.93616.36
7.3.60.0551.94416.47
7.3.50.0881.90916.45
7.3.40.0751.90516.32
7.3.30.0691.93216.45
7.3.20.0751.91716.41
7.3.10.0881.91216.36
7.3.00.0741.91316.34

preferences:
31.65 ms | 400 KiB | 5 Q