3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A0 { function foo($a, $b) { $a + $b; } } class A1 { function foo($a, $b) { $a + $b; } } class A2 { function foo($a, $b) { $a + $b; } } class A3 { function foo($a, $b) { $a + $b; } } class A4 { function foo($a, $b) { $a + $b; } } function row($name, $t) { printf("%-40s %8s x 10 µs\n", $name, number_format((microtime(true)-$t)*1e5, 2)); } $max = 5*1e1; $objects = array(new A0, new A1, new A2, new A3, new A4, new A5) ; $t = microtime (true); for ($j=0; $j<5; $j++) { for ($i=0; $i<$max; $i++) { $objects[$j]->foo(1, 'foo'); } } row($max.' x A::foo', $t); $t = microtime (true); for ($j=0; $j<5; $j++) { for ($i=0; $i<$max; $i++) { call_user_func_array(array($objects[$j], 'foo'), array(1, 'foo')); } } row($max.' x call_user_func_array', $t); $t = microtime (true); for ($j=0; $j<5; $j++) { $ref = new ReflectionMethod($objects[$j], 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($objects[$j], array(1, 'foo')); } } row($max.' x ReflectionMethod::invokeArgs', $t);

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.00.0030.01415.04
7.3.120.0040.01414.79
7.3.110.0040.01414.96
7.3.100.0090.00914.77
7.3.90.0090.00314.76
7.3.80.0060.00814.90
7.3.70.0040.00614.69
7.3.60.0030.01214.69
7.3.50.0080.00614.69
7.3.40.0030.01314.83
7.3.30.0020.01214.79
7.3.20.0100.00516.55
7.3.10.0070.00916.54
7.3.00.0000.01016.67
7.2.250.0070.01315.03
7.2.240.0120.00514.83
7.2.230.0080.00814.77
7.2.220.0030.01015.02
7.2.210.0070.00514.83
7.2.200.0100.00714.90
7.2.190.0030.01014.76
7.2.180.0050.01215.01
7.2.170.0080.00615.07
7.2.00.0030.00919.48
7.1.330.0040.01015.58
7.1.320.0050.00515.45
7.1.310.0060.00715.51
7.1.300.0030.01015.70
7.1.290.0070.00515.73
7.1.280.0050.00915.56
7.1.270.0070.00815.55
7.1.260.0040.00815.67
7.1.70.0100.00016.95
7.1.60.0110.01419.70
7.1.50.0060.01316.56
7.1.00.0000.08022.51
7.0.200.0080.00314.78
7.0.140.0070.07021.95
7.0.60.0130.07719.95
7.0.50.0070.06717.91
7.0.40.0100.08719.96
7.0.30.0200.04320.17
7.0.20.0200.04720.24
7.0.10.0070.08720.25
7.0.00.0100.06320.06
5.6.210.0000.04320.53
5.6.200.0030.07318.19
5.6.190.0030.04320.63
5.6.180.3730.04020.55
5.6.170.0270.09020.48
5.6.160.0100.08020.47
5.6.150.0170.07018.27
5.6.140.0100.07318.27
5.6.130.0070.07018.18
5.6.120.0030.08721.05
5.6.110.0070.07721.10
5.6.100.0030.09021.04
5.6.90.0070.08021.15
5.6.80.0070.08020.44
5.6.70.3670.03720.39
5.5.350.0070.07720.46
5.5.340.0000.07018.04
5.5.330.0100.03720.21
5.5.320.3100.05320.29
5.5.310.0200.08020.36
5.5.300.0100.07017.97
5.5.290.0030.08717.97
5.5.280.0030.05720.90
5.5.270.0070.04321.00
5.5.260.0070.05720.86
5.5.250.0100.07720.71
5.5.240.0330.07020.39
5.4.450.0400.04328.29
5.4.440.0330.04328.28
5.4.430.0370.04028.28
5.4.420.0200.05328.28
5.4.410.0470.03728.28
5.4.400.0230.03727.85
5.4.390.0400.04027.29
5.4.380.0230.05018.79
5.4.370.0100.05718.74
5.4.360.0300.05018.71
5.4.350.0000.07318.71
5.4.340.0270.05018.77
5.4.320.0090.03312.52
5.4.310.0050.03912.52
5.4.300.0090.03612.52
5.4.290.0070.04812.52
5.4.280.0080.03612.41
5.4.270.0060.04012.42
5.4.260.0110.04212.41
5.4.250.0080.03812.42
5.4.240.0050.03812.42
5.4.230.0080.03812.41
5.4.220.0080.03612.41
5.4.210.0060.03612.41
5.4.200.0080.03912.41
5.4.190.0050.05012.41
5.4.180.0060.04812.41
5.4.170.0110.03812.41
5.4.160.0050.03912.41
5.4.150.0040.04312.41
5.4.140.0070.03512.09
5.4.130.0050.03512.07
5.4.120.0070.03412.04
5.4.110.0050.03612.04
5.4.100.0090.03912.03
5.4.90.0060.04512.03
5.4.80.0030.04012.04
5.4.70.0070.03412.03
5.4.60.0070.03412.03
5.4.50.0070.03512.03
5.4.40.0060.03512.02
5.4.30.0070.03912.01
5.4.20.0090.03512.02
5.4.10.0050.04012.01
5.4.00.0070.04111.50
5.3.290.0110.03612.80
5.3.280.0110.04112.71
5.3.270.0060.05212.72
5.3.260.0090.04912.73
5.3.250.0090.03712.72
5.3.240.0050.04112.73
5.3.230.0130.04412.72
5.3.220.0060.04412.69
5.3.210.0090.04412.68
5.3.200.0040.04812.68
5.3.190.0090.04212.69
5.3.180.0070.04412.68
5.3.170.0100.04112.68
5.3.160.0080.04312.68
5.3.150.0070.03612.68
5.3.140.0080.03412.67
5.3.130.0070.03912.67
5.3.120.0070.04012.67
5.3.110.0130.04112.67
5.3.100.0090.03612.15
5.3.90.0040.04312.14
5.3.80.0060.03712.13
5.3.70.0060.04112.13
5.3.60.0100.04612.11
5.3.50.0090.04612.05
5.3.40.0090.05112.05
5.3.30.0030.04012.02
5.3.20.0050.04211.80
5.3.10.0080.03711.76
5.3.00.0090.04211.75
5.2.170.0060.0299.25
5.2.160.0010.0359.26
5.2.150.0060.0329.25
5.2.140.0090.0369.25
5.2.130.0100.0349.21
5.2.120.0060.0299.21
5.2.110.0070.0419.21
5.2.100.0070.0369.21
5.2.90.0030.0359.21
5.2.80.0040.0359.21
5.2.70.0090.0389.21
5.2.60.0080.0349.17
5.2.50.0050.0379.14
5.2.40.0080.0339.11
5.2.30.0050.0369.09
5.2.20.0070.0339.07
5.2.10.0050.0378.98
5.2.00.0070.0328.84
5.1.60.0040.0278.12
5.1.50.0050.0288.12
5.1.40.0040.0278.10
5.1.30.0070.0268.45
5.1.20.0050.0308.47
5.1.10.0040.0338.20
5.1.00.0110.0288.20
5.0.50.0030.0306.68
5.0.40.0100.0206.55
5.0.30.0100.0326.36
5.0.20.0010.0256.35
5.0.10.0070.0186.32
5.0.00.0030.0316.32
4.4.90.0030.0164.78
4.4.80.0020.0164.76
4.4.70.0040.0154.75
4.4.60.0040.0154.76
4.4.50.0040.0154.77
4.4.40.0010.0294.71
4.4.30.0040.0164.76
4.4.20.0010.0194.85
4.4.10.0060.0134.85
4.4.00.0040.0274.76
4.3.110.0040.0184.67
4.3.100.0050.0154.67
4.3.90.0060.0184.64
4.3.80.0040.0324.61
4.3.70.0100.0154.63
4.3.60.0120.0154.63
4.3.50.0070.0224.63
4.3.40.0030.0344.55
4.3.30.0010.0173.36
4.3.20.0020.0173.34
4.3.10.0030.0163.30
4.3.00.0070.01327.24

preferences:
36.81 ms | 401 KiB | 5 Q