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; } } class A5 { function foo($a, $b) { $a + $b; } } class A6 { 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; $count = 7; $objects = array(new A0, new A1, new A2, new A3, new A4, new A5, new A7) ; $t = microtime (true); for ($j=0; $j<$count; $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<$count; $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<$count; $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.0040.01415.00
7.3.120.0090.00914.95
7.3.110.0110.00715.09
7.3.100.0070.01014.71
7.3.90.0090.00314.95
7.3.80.0060.00614.29
7.3.70.0060.00314.89
7.3.60.0070.01014.77
7.3.50.0000.00914.42
7.3.40.0060.00914.81
7.3.30.0030.01314.66
7.3.20.0000.01016.44
7.3.10.0070.01016.18
7.3.00.0030.01016.57
7.2.250.0120.00314.90
7.2.240.0100.01015.17
7.2.230.0120.00014.93
7.2.220.0060.00915.07
7.2.210.0070.00714.79
7.2.200.0040.00814.66
7.2.190.0070.01015.07
7.2.180.0030.01014.76
7.2.170.0040.00814.77
7.2.00.0030.00919.27
7.1.330.0000.01215.74
7.1.320.0000.01315.64
7.1.310.0100.00315.69
7.1.300.0120.00015.34
7.1.290.0040.00815.60
7.1.280.0090.00915.50
7.1.270.0040.00815.73
7.1.260.0090.00615.30
7.1.70.0040.00417.22
7.1.60.0140.01019.70
7.1.50.0090.00916.73
7.1.00.0100.07022.36
7.0.200.0030.00714.86
7.0.140.0030.07322.18
7.0.60.0100.05720.00
7.0.50.0100.07017.87
7.0.40.0070.08020.11
7.0.30.0330.06020.07
7.0.20.0370.07320.09
7.0.10.0030.04320.19
7.0.00.0100.06320.19
5.6.280.0030.07320.80
5.6.210.0070.08320.63
5.6.200.0070.08318.20
5.6.190.0070.08320.43
5.6.180.3230.04320.42
5.6.170.0200.04320.55
5.6.160.0130.05720.57
5.6.150.0070.08718.27
5.6.140.0030.06318.22
5.6.130.0100.08018.21
5.6.120.0030.04321.13
5.6.110.0000.08721.17
5.6.100.0200.05721.14
5.6.90.0070.08321.13
5.6.80.0100.07320.41
5.6.70.4470.04020.41
5.5.350.0070.08320.51
5.5.340.0170.07018.00
5.5.330.0100.05020.26
5.5.320.3830.04320.51
5.5.310.0300.07320.51
5.5.300.0130.06018.08
5.5.290.0130.06317.98
5.5.280.0070.04320.76
5.5.270.0000.09020.67
5.5.260.0000.04720.75
5.5.250.0030.08320.52
5.5.240.0230.03020.31
5.4.450.0200.04728.29
5.4.440.0300.05028.28
5.4.430.0400.05028.28
5.4.420.0100.04028.28
5.4.410.0870.03319.34
5.4.400.0430.03727.71
5.4.390.0230.04727.29
5.4.380.0230.04318.59
5.4.370.0130.05318.77
5.4.360.0200.04318.59
5.4.350.0200.04718.76
5.4.340.0070.06018.61
5.4.320.0100.03412.53
5.4.310.0070.03712.52
5.4.300.0050.03712.53
5.4.290.0090.03912.52
5.4.280.0060.03612.42
5.4.270.0050.03812.43
5.4.260.0040.04112.42
5.4.250.0070.04412.42
5.4.240.0020.04412.42
5.4.230.0110.03712.41
5.4.220.0070.04012.42
5.4.210.0090.03212.41
5.4.200.0060.03712.41
5.4.190.0080.03412.41
5.4.180.0050.03712.41
5.4.170.0050.03812.42
5.4.160.0050.03712.41
5.4.150.0110.03212.41
5.4.140.0050.03812.09
5.4.130.0060.03512.08
5.4.120.0070.03412.04
5.4.110.0070.03512.04
5.4.100.0040.03712.04
5.4.90.0090.03312.04
5.4.80.0060.03712.04
5.4.70.0070.03412.03
5.4.60.0070.03412.04
5.4.50.0040.03812.04
5.4.40.0080.03812.02
5.4.30.0100.03612.02
5.4.20.0060.04012.02
5.4.10.0070.04312.02
5.4.00.0060.04911.51
5.3.290.0050.04412.80
5.3.280.0070.03912.72
5.3.270.0050.04012.73
5.3.260.0050.03912.72
5.3.250.0040.04012.72
5.3.240.0110.03212.73
5.3.230.0030.04112.72
5.3.220.0080.03912.69
5.3.210.0040.04412.69
5.3.200.0080.04612.68
5.3.190.0050.05012.68
5.3.180.0080.03812.69
5.3.170.0080.03912.68
5.3.160.0040.04612.69
5.3.150.0090.03412.68
5.3.140.0030.04212.67
5.3.130.0090.03912.67
5.3.120.0070.04312.66
5.3.110.0060.04212.67
5.3.100.0120.03112.16
5.3.90.0060.03712.13
5.3.80.0030.04112.13
5.3.70.0070.03712.13
5.3.60.0070.03612.11
5.3.50.0060.04512.06
5.3.40.0070.03712.06
5.3.30.0070.03612.02
5.3.20.0040.03911.82
5.3.10.0090.03311.76
5.3.00.0080.03511.75
5.2.170.0040.0319.26
5.2.160.0020.0329.25
5.2.150.0030.0329.26
5.2.140.0050.0319.25
5.2.130.0050.0299.21
5.2.120.0040.0309.21
5.2.110.0030.0319.22
5.2.100.0070.0289.22
5.2.90.0070.0299.22
5.2.80.0030.0369.21
5.2.70.0030.0389.21
5.2.60.0040.0319.17
5.2.50.0090.0329.13
5.2.40.0060.0319.11
5.2.30.0030.0319.09
5.2.20.0060.0279.07
5.2.10.0050.0288.98
5.2.00.0050.0368.84
5.1.60.0040.0248.14
5.1.50.0030.0328.13
5.1.40.0060.0268.12
5.1.30.0080.0228.46
5.1.20.0050.0278.48
5.1.10.0040.0268.21
5.1.00.0040.0308.21
5.0.50.0030.0236.70
5.0.40.0030.0206.55
5.0.30.0050.0296.37
5.0.20.0030.0206.36
5.0.10.0030.0206.34
5.0.00.0040.0316.32
4.4.90.0030.0154.78
4.4.80.0010.0164.76
4.4.70.0000.0184.76
4.4.60.0010.0174.75
4.4.50.0010.0174.77
4.4.40.0000.0284.71
4.4.30.0040.0144.76
4.4.20.0020.0174.84
4.4.10.0030.0184.85
4.4.00.0020.0274.76
4.3.110.0040.0174.66
4.3.100.0070.0124.66
4.3.90.0040.0144.63
4.3.80.0040.0244.61
4.3.70.0030.0154.63
4.3.60.0050.0134.63
4.3.50.0030.0174.62
4.3.40.0030.0254.56
4.3.30.0020.0173.37
4.3.20.0010.0173.35
4.3.10.0010.0173.30
4.3.00.0070.01027.10

preferences:
33.72 ms | 401 KiB | 5 Q