3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * My results: * * Average time to process 10,000 items, 100 runs * * Array:: 0.0034920692443848 * Obj: 0.026956255435944 */ /** * Class foo */ class Foo { /** * @var */ protected $bar; /** * Builds it. * * @param mixed $bar * Something bar */ public function __construct($bar) { $this->bar = $bar; } /** * Something. * * @return mixed * Something */ public function getBar() { return $this->bar; } } $foo['bar'] = 'baz'; $baz = new Foo('baz'); $cycles = 10000; $array = $obj = array(); for ($j = 0; $j < 100; $j++) { $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $foo['bar']; } $array[] = microtime(TRUE) - $start; $start = microtime(TRUE); for ($i = 0; $i < $cycles; $i++) { $b = $baz->getBar(); } $obj[] = microtime(TRUE) - $start; } echo "Arr: "; echo array_sum($array) / count($array); echo "\n\nObj: "; echo array_sum($obj) / count($obj);

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)
7.4.10.0070.08315.02
7.4.00.0030.06615.03
7.3.130.0100.07714.92
7.3.120.0000.09714.80
7.3.110.0100.08915.04
7.3.100.0030.07114.87
7.3.90.0030.06614.90
7.3.80.0030.08614.68
7.3.70.0030.06714.93
7.3.60.0100.06814.99
7.3.50.0070.06314.90
7.3.40.0070.06914.91
7.3.30.0060.07114.84
7.3.20.0100.05816.81
7.3.10.0100.06316.64
7.3.00.0130.06116.74
7.2.260.0070.07515.06
7.2.250.0030.10414.67
7.2.240.0000.08815.10
7.2.230.0030.07415.22
7.2.220.0100.07214.86
7.2.210.0100.07115.02
7.2.200.0100.06915.20
7.2.190.0070.06715.18
7.2.180.0100.06415.11
7.2.170.0100.06215.05
7.2.160.0070.07214.86
7.2.150.0030.07317.00
7.2.140.0030.07016.93
7.2.130.0100.06516.84
7.2.120.0070.09316.99
7.2.110.0070.07516.92
7.2.100.0000.08117.07
7.2.90.0030.07816.96
7.2.80.0000.09817.08
7.2.70.0030.07116.99
7.2.60.0030.06917.02
7.2.50.0030.07417.22
7.2.40.0030.07517.10
7.2.30.0030.07117.11
7.2.20.0070.06416.98
7.2.10.0070.06316.83
7.2.00.0030.06918.21
7.1.330.0030.16115.82
7.1.320.0030.19815.77
7.1.310.0030.17915.85
7.1.300.0070.17115.86
7.1.290.0070.15715.47
7.1.280.0070.15915.70
7.1.270.0030.15915.74
7.1.260.0030.16215.84
7.1.250.0000.17915.88
7.1.240.0030.16215.83
7.1.230.0070.16915.63
7.1.220.0030.16415.76
7.1.210.0030.18715.92
7.1.200.0000.17715.64
7.1.190.0070.15515.80
7.1.180.0000.15815.69
7.1.170.0030.15515.75
7.1.160.0100.16315.91
7.1.150.0070.16015.86
7.1.140.0070.15115.64
7.1.130.0000.16915.84
7.1.120.0070.16315.54
7.1.110.0100.15915.80
7.1.100.0070.16716.00
7.1.90.0030.15615.77
7.1.80.0030.15315.60
7.1.70.0030.11116.46
7.1.60.0050.15117.62
7.1.50.0070.14416.50
7.1.40.0030.18915.90
7.1.30.0030.17215.68
7.1.20.0030.16715.67
7.1.10.0000.19615.68
7.1.00.0050.16018.99
7.0.330.0030.19415.24
7.0.320.0070.17115.45
7.0.310.0030.19215.54
7.0.300.0070.15115.47
7.0.290.0000.15615.25
7.0.280.0070.17215.44
7.0.270.0100.14715.52
7.0.260.0030.17715.22
7.0.250.0030.17715.58
7.0.240.0030.17615.51
7.0.230.0100.15615.41
7.0.220.0000.17715.39
7.0.210.0070.15815.53
7.0.200.0050.11116.03
7.0.190.0070.16015.37
7.0.180.0070.17815.37
7.0.170.0030.19715.11
7.0.160.0030.16715.59
7.0.150.0100.14815.41
7.0.140.0020.16918.67
7.0.130.0030.15115.54
7.0.120.0070.15815.29
7.0.110.0000.17515.35
7.0.100.0180.15917.65
7.0.90.0130.14817.67
7.0.80.0120.14117.55
7.0.70.0130.13117.61
7.0.60.0070.12717.73
7.0.50.0070.14517.93
7.0.40.0020.12916.82
7.0.30.0100.17016.80
7.0.20.0080.15616.84
7.0.10.0070.16016.87
7.0.00.0130.14116.71
5.6.400.0030.32914.61
5.6.390.0030.33514.68
5.6.380.0000.33914.63
5.6.370.0070.32614.62
5.6.360.0070.34214.71
5.6.350.0030.33314.62
5.6.340.0030.32914.72
5.6.330.0030.40214.50
5.6.320.0070.38914.66
5.6.310.0000.37714.61
5.6.300.0000.34414.74
5.6.290.0000.37314.51
5.6.280.0070.29517.81
5.6.270.0000.38314.63
5.6.260.0000.37114.46
5.6.250.0070.29917.65
5.6.240.0070.27417.61
5.6.230.0030.27817.63
5.6.220.0020.26317.70
5.6.210.0080.27717.54
5.6.200.0130.25117.73
5.6.190.0030.27417.60
5.6.180.0050.27817.68
5.6.170.0030.28517.70
5.6.160.0120.29117.77
5.6.150.0070.29717.70
5.6.140.0030.33517.82
5.6.130.0070.28717.87
5.6.120.0070.31417.86
5.6.110.0120.28617.79
5.6.100.0070.32317.97
5.6.90.0050.30517.65
5.6.80.0070.30917.40
5.6.70.0080.30817.49
5.6.60.0100.34617.53
5.6.50.0050.32917.56
5.6.40.0030.28617.36
5.6.30.0070.32917.54
5.6.20.0120.29917.35
5.6.10.0080.31217.45
5.6.00.0100.29117.41
5.5.380.0130.29617.34
5.5.370.0120.29517.42
5.5.360.0080.28717.44
5.5.350.0030.27117.48
5.5.340.0080.27817.64
5.5.330.0050.25617.57
5.5.320.0020.28817.56
5.5.310.0050.31517.47
5.5.300.0130.28317.80
5.5.290.0080.30517.78
5.5.280.0100.27717.67
5.5.270.0080.27617.52
5.5.260.0030.33217.71
5.5.250.0070.33317.57
5.5.240.0030.31017.24
5.5.230.0050.35517.25
5.5.220.0070.32817.28
5.5.210.0050.31417.41
5.5.200.0100.31117.33
5.5.190.0070.32317.12
5.5.180.0080.31117.38
5.5.170.0130.35814.48
5.5.160.0130.32317.26
5.5.150.0030.29617.23
5.5.140.0020.29717.26
5.5.130.0100.27817.11
5.5.120.0080.28617.24
5.5.110.0100.31417.42
5.5.100.0100.33817.29
5.5.90.0020.29517.26
5.5.80.0080.33917.17
5.5.70.0070.31617.26
5.5.60.0050.28917.19
5.5.50.0070.30317.31
5.5.40.0080.30117.32
5.5.30.0050.30617.15
5.5.20.0100.31317.30
5.5.10.0080.36417.26
5.5.00.0070.29117.05
5.4.450.0070.29815.56
5.4.440.0070.30415.47
5.4.430.0030.29215.38
5.4.420.0030.31315.22
5.4.410.0080.32515.07
5.4.400.0070.32014.94
5.4.390.0020.27714.96
5.4.380.0070.33015.10
5.4.370.0050.30015.29
5.4.360.0080.30315.11
5.4.350.0080.28815.06
5.4.340.0050.31015.00
5.4.330.0030.37111.25
5.4.320.0080.30415.02
5.4.310.0030.31314.94
5.4.300.0050.27615.11
5.4.290.0020.32414.99
5.4.280.0100.30815.16
5.4.270.0030.28315.16
5.4.260.0180.28415.12
5.4.250.0080.29515.13
5.4.240.0130.29015.11
5.4.230.0070.33915.06
5.4.220.0030.32315.22
5.4.210.0080.29314.97
5.4.200.0080.30215.02
5.4.190.0000.29615.18
5.4.180.0000.30315.22
5.4.170.0120.30815.11
5.4.160.0000.33415.18
5.4.150.0030.30715.07
5.4.140.0020.32013.78
5.4.130.0050.31513.74
5.4.120.0080.33313.76
5.4.110.0070.30713.76
5.4.100.0020.27213.86
5.4.90.0030.31613.70
5.4.80.0030.32413.87
5.4.70.0030.28113.77
5.4.60.0100.32213.86
5.4.50.0050.31013.92
5.4.40.0020.30113.75
5.4.30.0080.28213.77
5.4.20.0030.30513.76
5.4.10.0050.30613.77
5.4.00.0080.28113.59
5.3.290.0100.40112.76
5.3.280.0050.47712.58
5.3.270.0150.41312.60
5.3.260.0050.43912.62
5.3.250.0030.43812.73
5.3.240.0000.40312.54
5.3.230.0050.42112.59
5.3.220.0030.46412.62
5.3.210.0070.43912.62
5.3.200.0070.49212.63
5.3.190.0030.43212.62
5.3.180.0080.42512.71
5.3.170.0050.43212.72
5.3.160.0020.43312.73
5.3.150.0030.43712.61
5.3.140.0170.43712.62
5.3.130.0020.43212.65
5.3.120.0030.44512.57
5.3.110.0030.39612.65
5.3.100.0100.41412.44
5.3.90.0020.41812.31
5.3.80.0020.44712.25
5.3.70.0050.48612.29
5.3.60.0000.48712.36
5.3.50.0070.45612.33
5.3.40.0050.48612.36
5.3.30.0080.41212.34
5.3.20.0020.40412.12
5.3.10.0020.39411.97
5.3.00.0020.42511.98
5.2.170.0070.36311.27
5.2.160.0100.35011.29
5.2.150.0070.35711.23
5.2.140.0070.32711.28
5.2.130.0000.29711.16
5.2.120.0000.29311.12
5.2.110.0030.29711.02
5.2.100.0000.28011.07
5.2.90.0000.31711.25
5.2.80.0000.30311.06
5.2.70.0000.31711.16
5.2.60.0030.30011.00
5.2.50.0030.30310.97
5.2.40.0000.31711.08
5.2.30.0000.30011.07
5.2.20.0030.30010.95
5.2.10.0400.24310.97
5.2.00.0000.24310.89
5.1.60.0000.28310.79
5.1.50.0030.35710.79
5.1.40.0030.31310.79
5.1.30.0070.35310.79
5.1.20.0000.36010.79
5.1.10.0030.36310.79
5.1.00.0130.34710.79
5.0.50.0070.58310.79
5.0.40.0070.53710.79
5.0.30.0030.55010.79
5.0.20.0000.53010.79
5.0.10.0130.55010.79
5.0.00.0030.59310.79
4.4.90.0070.01010.79
4.4.80.0000.02310.79
4.4.70.0000.01310.79
4.4.60.0000.01310.79
4.4.50.0030.01310.79
4.4.40.0030.02010.79
4.4.30.0030.03310.79
4.4.20.0030.03310.79
4.4.10.0030.03710.79
4.4.00.0070.05010.79
4.3.110.0000.03310.79
4.3.100.0100.02710.79
4.3.90.0000.03710.79
4.3.80.0000.04010.79
4.3.70.0000.03710.79
4.3.60.0000.02010.79
4.3.50.0030.03310.79
4.3.40.0030.04710.79
4.3.30.0000.02010.79
4.3.20.0030.03010.79
4.3.10.0030.03310.79
4.3.00.0000.03010.79

preferences:
36.76 ms | 401 KiB | 5 Q