3v4l.org

run code in 300+ PHP versions simultaneously
<?php const N = 1000; class Redis { public function run($n) { $a = rand($n, 2*$n); } } class A { protected $redis; function __construct() { $this->redis = new Redis(); } function getRedis() { return $this->redis; } function run() { for ($i = 0; $i < N; $i++) { $this->getRedis()->run($i); } } } class B { protected $redis; function __construct() { $this->redis = new Redis(); } function run() { for ($i = 0; $i < N; $i++) { $this->redis->run($i); } } } $time = microtime(true); $a = new A(); $a->run(); $et1 = microtime(true) - $time; print 'Execution time with *property* accessor: ' . $et1 . PHP_EOL; $time = microtime(true); $b = new B(); $b->run(); $et2 = microtime(true) - $time; print 'Execution time *without* property accessor: ' . $et2 . PHP_EOL; print 'Ratio: ' . ($et1/$et2) . PHP_EOL;

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.0060.00916.73
7.4.00.0140.00716.49
7.3.130.0100.00716.71
7.3.120.0040.01516.29
7.3.110.0130.00316.56
7.3.100.0060.00916.72
7.3.90.0000.01216.38
7.3.80.0100.00716.52
7.3.70.0130.00016.43
7.3.60.0040.01116.62
7.3.50.0030.00716.52
7.3.40.0070.01116.27
7.3.30.0140.00316.41
7.3.20.0070.00718.24
7.3.10.0030.01418.22
7.3.00.0040.01118.16
7.2.260.0080.00516.44
7.2.250.0100.01016.66
7.2.240.0100.00616.81
7.2.230.0100.00316.62
7.2.220.0090.00416.80
7.2.210.0100.00716.82
7.2.200.0110.00016.44
7.2.190.0070.00716.66
7.2.180.0090.00616.55
7.2.170.0030.01416.61
7.2.160.0060.00916.50
7.2.150.0030.01218.55
7.2.140.0030.01318.38
7.2.130.0070.00718.45
7.2.120.0070.00718.40
7.2.110.0070.01018.40
7.2.100.0100.00718.52
7.2.90.0080.01218.47
7.2.80.0040.01218.36
7.2.70.0070.01018.49
7.2.60.0060.00618.46
7.2.50.0070.01018.32
7.2.40.0000.01418.39
7.2.30.0100.00618.49
7.2.20.0090.00618.37
7.2.10.0100.00718.45
7.2.00.0100.00518.89
7.1.330.0060.01017.43
7.1.320.0060.01017.23
7.1.310.0030.01317.39
7.1.300.0000.01417.42
7.1.290.0120.00617.35
7.1.280.0030.00917.44
7.1.270.0150.00317.42
7.1.260.0130.00317.48
7.1.250.0030.01217.42
7.1.240.0100.00717.23
7.1.230.0030.01217.48
7.1.220.0080.00417.24
7.1.210.0040.01117.21
7.1.200.0040.01417.38
7.1.190.0030.01117.33
7.1.180.0040.01117.51
7.1.170.0030.01017.30
7.1.160.0070.00717.44
7.1.150.0040.01117.35
7.1.140.0120.00317.31
7.1.130.0110.00717.21
7.1.120.0040.01117.29
7.1.110.0040.01117.25
7.1.100.0070.01117.25
7.1.90.0090.00617.34
7.1.80.0070.01017.25
7.1.70.0030.01017.24
7.1.60.0100.00818.43
7.1.50.0130.01026.04
7.1.40.0100.00717.34
7.1.30.0070.01017.43
7.1.20.0040.00817.36
7.1.10.0030.01317.47
7.1.00.0050.03919.84
7.0.330.0090.00616.91
7.0.320.0030.01216.92
7.0.310.0060.00917.04
7.0.300.0060.00617.10
7.0.290.0040.00916.89
7.0.280.0060.00917.13
7.0.270.0100.00717.07
7.0.260.0080.00816.99
7.0.250.0100.00617.05
7.0.240.0040.00717.08
7.0.230.0060.00917.05
7.0.220.0070.01017.07
7.0.210.0040.01517.08
7.0.200.0050.00716.75
7.0.190.0030.01016.92
7.0.180.0030.01316.91
7.0.170.0100.00617.14
7.0.160.0100.00716.86
7.0.150.0040.00717.19
7.0.140.0020.04519.52
7.0.130.0040.01116.89
7.0.120.0060.00616.95
7.0.110.0080.04118.55
7.0.100.0080.04218.50
7.0.90.0070.04318.49
7.0.80.0080.03718.58
7.0.70.0110.04118.40
7.0.60.0100.04318.50
7.0.50.0030.04818.48
7.0.40.0060.04217.38
7.0.30.0050.04317.31
7.0.20.0030.03117.36
7.0.10.0090.02817.34
7.0.00.0050.04717.45
5.6.400.0000.01415.99
5.6.390.0100.00616.09
5.6.380.0070.00715.80
5.6.370.0030.01016.07
5.6.360.0000.01115.73
5.6.350.0110.01115.70
5.6.340.0060.00615.78
5.6.330.0090.00616.00
5.6.320.0030.01416.24
5.6.310.0100.00616.01
5.6.300.0090.00916.07
5.6.290.0060.00916.25
5.6.280.0080.04018.57
5.6.270.0040.01216.05
5.6.260.0040.03118.24
5.6.250.0040.04218.28
5.6.240.0100.02718.45
5.6.230.0060.04418.19
5.6.220.0080.04318.21
5.6.210.0070.04518.36
5.6.200.0070.04218.25
5.6.190.0050.04418.35
5.6.180.0030.05218.18
5.6.170.0100.03718.27
5.6.160.0030.04818.29
5.6.150.0080.04318.17
5.6.140.0080.05318.17
5.6.130.0100.04018.26
5.6.120.0100.04318.18
5.6.110.0070.04718.31
5.6.100.0080.04518.21
5.6.90.0050.05118.41
5.6.80.0070.04418.00
5.6.70.0070.04517.89
5.6.60.0030.04518.02
5.6.50.0030.04517.92
5.6.40.0080.04017.89
5.6.30.0050.04017.92
5.6.20.0100.04617.93
5.6.10.0030.02817.95
5.6.00.0140.03817.92
5.5.380.0070.04518.05
5.5.370.0080.03818.08
5.5.360.0050.04818.20
5.5.350.0080.04218.20
5.5.340.0070.04618.33
5.5.330.0190.03218.46
5.5.320.0080.04218.30
5.5.310.0080.04518.39
5.5.300.0110.03418.38
5.5.290.0020.03218.44
5.5.280.0070.04618.38
5.5.270.0030.04718.42
5.5.260.0080.04318.39
5.5.250.0090.03218.27
5.5.240.0080.04617.89
5.5.230.0150.03918.06
5.5.220.0110.03818.01
5.5.210.0090.02718.10
5.5.200.0050.04717.96
5.5.190.0080.04018.06
5.5.180.0100.04218.09
5.5.170.0030.01415.71
5.5.160.0050.04218.12
5.5.150.0100.03518.02
5.5.140.0110.03917.94
5.5.130.0050.04318.06
5.5.120.0080.04718.11
5.5.110.0080.04117.99
5.5.100.0050.03017.78
5.5.90.0090.04218.00
5.5.80.0050.04518.10
5.5.70.0030.04818.00
5.5.60.0080.04817.93
5.5.50.0080.04417.89
5.5.40.0070.03718.00
5.5.30.0080.04417.92
5.5.20.0050.04117.97
5.5.10.0040.02717.93
5.5.00.0130.04017.97
5.4.450.0080.02516.75
5.4.440.0050.04716.65
5.4.430.0060.04516.82
5.4.420.0050.04516.77
5.4.410.0050.04216.76
5.4.400.0030.03816.51
5.4.390.0080.04016.65
5.4.380.0050.04116.58
5.4.370.0080.03816.66
5.4.360.0050.04316.50
5.4.350.0050.04216.48
5.4.340.0090.03816.56
5.4.330.0000.01113.98
5.4.320.0080.03716.50
5.4.310.0070.04216.61
5.4.300.0050.04116.63
5.4.290.0070.04016.65
5.4.280.0030.04716.56
5.4.270.0050.04316.51
5.4.260.0070.04216.50
5.4.250.0070.04016.49
5.4.240.0080.04216.50
5.4.230.0060.04316.57
5.4.220.0080.04316.54
5.4.210.0030.03616.61
5.4.200.0030.04516.57
5.4.190.0110.03516.53
5.4.180.0030.04716.58
5.4.170.0070.04116.65
5.4.160.0050.03716.57
5.4.150.0110.03916.47
5.4.140.0090.03515.25
5.4.130.0070.04215.29
5.4.120.0030.04315.19
5.4.110.0050.03015.27
5.4.100.0070.03815.30
5.4.90.0070.03815.27
5.4.80.0080.03615.26
5.4.70.0090.03415.29
5.4.60.0020.04515.31
5.4.50.0070.04215.11
5.4.40.0030.04515.24
5.4.30.0070.02515.13
5.4.20.0110.03515.11
5.4.10.0070.04015.20
5.4.00.0050.04014.88
5.3.290.0020.02714.35
5.3.280.0070.04214.36
5.3.270.0050.03814.42
5.3.260.0120.03514.32
5.3.250.0050.04314.34
5.3.240.0050.04014.37
5.3.230.0080.03214.30
5.3.220.0070.03514.40
5.3.210.0070.04514.29
5.3.200.0040.03914.28
5.3.190.0080.02414.29
5.3.180.0080.04014.35
5.3.170.0030.04214.26
5.3.160.0080.04214.35
5.3.150.0050.03014.27
5.3.140.0050.04214.28
5.3.130.0070.04314.28
5.3.120.0030.04314.27
5.3.110.0080.03814.31
5.3.100.0070.04514.09
5.3.90.0050.04614.02
5.3.80.0020.04514.08
5.3.70.0060.04114.01
5.3.60.0050.04714.01
5.3.50.0030.04113.96
5.3.40.0030.04013.90
5.3.30.0130.03013.94
5.3.20.0080.03313.82
5.3.10.0050.03113.82
5.3.00.0090.02413.86
5.2.170.0100.04712.05
5.2.160.0030.06312.05
5.2.150.0030.05712.05
5.2.140.0100.05712.05
5.2.130.0070.06012.05
5.2.120.0000.04312.05
5.2.110.0000.05712.05
5.2.100.0100.06012.05
5.2.90.0030.06012.05
5.2.80.0030.06012.05
5.2.70.0130.05312.05
5.2.60.0100.05712.05
5.2.50.0070.06012.05
5.2.40.0030.06012.05
5.2.30.0070.04712.05
5.2.20.0070.06012.05
5.2.10.0170.04712.05
5.2.00.0030.04312.05
5.1.60.0070.05312.05
5.1.50.0000.05712.05
5.1.40.0070.05012.05
5.1.30.0070.04012.05
5.1.20.0100.04712.05
5.1.10.0070.03712.05
5.1.00.0070.03312.05
5.0.50.0030.03712.05
5.0.40.0030.01712.05
5.0.30.0030.03012.05
5.0.20.0030.02012.05
5.0.10.0030.01712.05
5.0.00.0030.02712.05
4.4.90.0030.02012.05
4.4.80.0030.03012.05
4.4.70.0000.03712.05
4.4.60.0030.03712.05
4.4.50.0000.03712.05
4.4.40.0100.04012.05
4.4.30.0070.02312.05
4.4.20.0070.03012.05
4.4.10.0000.01712.05
4.4.00.0000.02712.05
4.3.110.0030.03012.05
4.3.100.0070.02012.05
4.3.90.0070.01012.05
4.3.80.0000.02712.05
4.3.70.0000.01712.05
4.3.60.0000.02012.05
4.3.50.0000.01712.05
4.3.40.0030.02312.05
4.3.30.0000.01312.05
4.3.20.0000.01712.05
4.3.10.0030.01312.05
4.3.00.0030.01312.05

preferences:
40.6 ms | 401 KiB | 5 Q