3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Memcache { private $data = []; public function set($key, $value) { $this->data[$key] = $value; } public function get($key) { return isset($this->data[$key]) ? $this->data[$key] : false; } } class CachingProxy { private $cache = null; private $instance = null; public function __construct(Memcache $cache, $instance) { $this->cache = $cache; $this->instance = $instance; } public function __call($method, $arguments) { var_dump($method, $arguments); die; if (substr($method, 0, 3) !== 'get') { $result = call_user_func_array($method, $arguments); } else { $uniqueId = $method . serialize($arguments); $result = $this->cache->get($uniqueId); if ($result === false) { $result = call_user_func_array($method, $arguments); $this->cache->set($uniqueId, $result); } } return $result; } } class ImportantService { public function getInformation($uniqueIdentifier) { $result = $this->cache->get($uniqueIdentifier); if ($result === false) { $result = $this->dataSource->getOne($uniqueIdentifier); $this->cache->set($uniqueIdentifier, $result); } return $result; } } $cachedService = new CachingProxy(new Memcache(), new ImportantService()); $result = $cachedService->getInformation(123); // First call goes to a data source $more = $cachedService->getInformation(123); // From cache now

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.3.60.0140.00718.23
8.3.50.0140.01016.49
8.3.40.0090.00618.78
8.3.30.0040.01118.96
8.3.20.0030.00520.34
8.3.10.0080.00023.52
8.3.00.0060.00317.80
8.2.180.0150.00316.75
8.2.170.0100.01022.96
8.2.160.0100.00320.38
8.2.150.0140.00024.18
8.2.140.0020.00524.66
8.2.130.0080.00026.16
8.2.120.0060.00317.50
8.2.110.0060.00622.26
8.2.100.0030.01019.64
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0000.00817.63
8.2.60.0040.00417.80
8.2.50.0060.00318.07
8.2.40.0060.00619.25
8.2.30.0000.00820.63
8.2.20.0050.00317.82
8.2.10.0040.00417.94
8.2.00.0000.00718.01
8.1.280.0060.00925.92
8.1.270.0060.01024.02
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00322.56
8.1.230.0120.00017.64
8.1.220.0030.00617.74
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0030.00517.25
8.1.180.0080.00018.10
8.1.170.0060.00318.59
8.1.160.0060.00321.88
8.1.150.0040.00418.82
8.1.140.0040.00417.42
8.1.130.0000.00817.70
8.1.120.0000.00817.33
8.1.110.0040.00417.35
8.1.100.0040.00417.34
8.1.90.0070.00017.43
8.1.80.0090.00017.31
8.1.70.0000.00817.39
8.1.60.0050.00517.50
8.1.50.0050.00317.54
8.1.40.0080.00017.45
8.1.30.0000.00817.60
8.1.20.0000.00817.70
8.1.10.0050.00317.60
8.1.00.0080.00017.50
8.0.300.0000.00718.77
8.0.290.0000.00816.63
8.0.280.0050.00318.46
8.0.270.0040.00417.15
8.0.260.0060.00017.21
8.0.250.0040.00416.98
8.0.240.0040.00416.96
8.0.230.0070.00017.03
8.0.220.0030.00516.95
8.0.210.0000.00716.89
8.0.200.0040.00416.82
8.0.190.0000.00816.86
8.0.180.0000.00816.97
8.0.170.0000.00817.01
8.0.160.0040.00416.92
8.0.150.0040.00416.80
8.0.140.0040.00416.90
8.0.130.0000.00613.36
8.0.120.0000.00916.89
8.0.110.0000.00716.94
8.0.100.0040.00416.83
8.0.90.0070.00016.79
8.0.80.0100.00616.90
8.0.70.0030.00616.84
8.0.60.0030.00416.80
8.0.50.0040.00416.70
8.0.30.0100.01016.91
8.0.20.0100.00817.40
8.0.10.0040.00416.88
8.0.00.0080.01016.95
7.4.330.0000.00615.08
7.4.320.0070.00016.57
7.4.300.0000.00716.63
7.4.290.0040.00416.45
7.4.280.0060.00316.58
7.4.270.0100.00016.61
7.4.260.0030.00516.52
7.4.250.0000.00716.58
7.4.240.0050.00216.54
7.4.230.0000.00716.63
7.4.220.0090.00916.67
7.4.210.0000.02016.66
7.4.200.0080.00016.68
7.4.160.0030.01216.47
7.4.150.0080.01117.40
7.4.140.0150.00617.86
7.4.130.0100.01116.50
7.4.120.0120.00616.53
7.4.110.0120.00916.45
7.4.100.0130.00616.63
7.4.90.0070.01016.44
7.4.80.0100.01019.39
7.4.70.0100.00716.42
7.4.60.0090.00916.49
7.4.50.0000.00416.17
7.4.40.0120.00916.46
7.4.30.0100.00716.57
7.4.00.0040.01115.07
7.3.330.0000.00513.41
7.3.320.0050.00013.36
7.3.310.0030.00316.35
7.3.300.0070.00016.21
7.3.290.0070.00916.29
7.3.280.0120.00716.30
7.3.270.0110.00717.40
7.3.260.0040.01316.27
7.3.250.0120.00916.44
7.3.240.0070.01016.28
7.3.230.0120.00416.60
7.3.210.0130.00416.30
7.3.200.0070.01016.41
7.3.190.0060.01016.27
7.3.180.0090.00616.43
7.3.170.0140.00916.52
7.3.160.0060.01116.34
7.3.00.0130.00016.71
7.2.330.0110.00716.44
7.2.320.0110.00716.84
7.2.310.0070.01016.66
7.2.300.0090.00816.67
7.2.290.0090.00916.77
7.2.130.0060.00616.89
7.2.120.0110.00316.90
7.2.110.0080.00316.68
7.2.100.0030.00916.87
7.2.90.0030.01516.55
7.2.80.0030.00616.64
7.2.70.0090.00616.41
7.2.60.0030.00617.00
7.2.50.0000.01516.84
7.2.40.0060.00616.55
7.2.30.0030.01316.75
7.2.20.0030.01016.95
7.2.10.0090.00616.77
7.2.00.0050.01218.24
7.1.250.0100.00315.99
7.1.240.0040.00815.50
7.1.230.0030.00615.92
7.1.220.0000.01215.65
7.1.210.0090.00615.59
7.1.200.0000.01415.89
7.1.190.0030.00915.47
7.1.180.0030.00915.79
7.1.170.0030.00715.88
7.1.160.0070.00315.63
7.1.150.0100.00315.73
7.1.140.0040.00715.73
7.1.130.0060.00915.88
7.1.120.0070.00715.80
7.1.110.0070.00715.47
7.1.100.0010.01116.85
7.1.90.0090.00615.70
7.1.80.0070.00715.96
7.1.70.0050.00516.51
7.1.60.0110.00817.50
7.1.50.0120.01025.29
7.1.40.0030.01015.81
7.1.30.0030.01315.82
7.1.20.0000.01015.73
7.1.10.0000.01415.67
7.1.00.0020.04518.97
7.0.330.0060.00615.52
7.0.320.0040.00715.15
7.0.310.0060.00615.15
7.0.300.0040.01115.47
7.0.290.0120.00015.07
7.0.280.0040.00715.43
7.0.270.0030.00615.24
7.0.260.0100.00315.24
7.0.250.0070.00715.46
7.0.240.0080.00615.54
7.0.230.0070.00715.57
7.0.220.0030.00915.23
7.0.210.0100.00315.21
7.0.200.0090.00316.06
7.0.190.0090.00315.09
7.0.180.0100.00315.21
7.0.170.0100.00315.32
7.0.160.0040.00715.50
7.0.150.0140.00315.41
7.0.140.0070.00315.21
7.0.130.0040.01115.30
7.0.120.0030.01015.34
7.0.110.0040.01115.32
7.0.100.0040.01115.28
7.0.90.0030.00715.37
7.0.80.0120.00415.10
7.0.70.0040.00715.45
7.0.60.0070.02117.72
7.0.50.0150.03816.58
7.0.40.0030.02416.82
7.0.30.0150.04216.92
7.0.20.0100.03216.77
7.0.10.0080.02616.87
7.0.00.0070.04316.83
5.6.380.0060.00914.57
5.6.370.0030.00714.42
5.6.360.0060.00914.60
5.6.350.0070.00414.55
5.6.340.0030.01213.99
5.6.330.0030.00914.59
5.6.320.0000.01314.40
5.6.310.0060.00314.08
5.6.300.0000.01514.42
5.6.290.0070.00714.37
5.6.280.0000.02417.62
5.6.270.0110.00314.42
5.6.260.0060.00314.26
5.6.250.0140.00014.06
5.6.240.0080.00814.40
5.6.230.0040.01114.45
5.6.220.0000.01214.28
5.6.210.0080.04517.51
5.6.200.0030.04016.36
5.6.190.0020.04217.35
5.6.180.0290.04117.26
5.6.170.0200.04017.34
5.6.160.0070.02117.33
5.6.150.0090.03716.28
5.6.140.0080.02816.42
5.6.130.0080.02016.18
5.6.120.0070.02317.48
5.6.110.0070.04617.65
5.6.100.0020.02817.68
5.6.90.0110.03617.68
5.6.80.0070.04617.53
5.6.70.0030.01014.42
5.6.60.0000.01514.30
5.6.50.0000.01414.29
5.6.40.0060.00614.49
5.6.30.0030.01014.23
5.6.20.0060.00314.09
5.6.10.0080.00314.18
5.6.00.0090.00314.17
5.5.380.0100.00011.60
5.5.370.0030.00511.60
5.5.360.0050.00511.60
5.5.350.0030.04016.01
5.5.340.0030.02414.77
5.5.330.0090.03415.91
5.5.320.1530.02516.02
5.5.310.0180.04316.06
5.5.300.0060.04314.82
5.5.290.0030.02514.78
5.5.280.0040.03816.18
5.5.270.0090.04016.28
5.5.260.0070.03816.24
5.5.250.0050.05016.06
5.5.240.0030.04215.83
5.5.230.0040.00411.60
5.5.220.0030.00311.60
5.5.210.0060.00011.60
5.5.200.0040.00411.60
5.5.190.0050.00211.60
5.5.180.0000.01011.60
5.5.170.0030.01011.60
5.5.160.0110.00011.60
5.5.150.0040.00711.60
5.5.140.0050.00311.60
5.5.130.0040.00411.60
5.5.120.0040.00711.60
5.5.110.0030.00711.60
5.5.100.0030.00511.60
5.5.90.0000.01111.60
5.5.80.0100.00311.60
5.5.70.0060.00011.60
5.5.60.0070.00411.60
5.5.50.0070.00011.60
5.5.40.0030.00711.60
5.5.30.0080.00311.60
5.5.20.0090.00611.60
5.5.10.0000.01111.60
5.5.00.0060.00611.60
5.4.450.0340.03015.49
5.4.440.0390.02815.59
5.4.430.0280.02915.60
5.4.420.0250.03015.47
5.4.410.0320.02815.43
5.4.400.0400.03615.45
5.4.390.0400.02715.25
5.4.380.0290.03415.38
5.4.370.0330.03815.31
5.4.360.0300.03515.33
5.4.350.0280.03115.40
5.4.340.0180.03615.38
5.4.330.0000.00911.60
5.4.320.0300.03715.38
5.4.310.0410.03815.49
5.4.300.0470.03815.29
5.4.290.0170.04315.36
5.4.280.0410.04115.44
5.4.270.0330.04215.42
5.4.260.0360.03115.23
5.4.250.0150.02515.25
5.4.240.0360.03615.29
5.4.230.0350.03615.44
5.4.220.0410.02815.41
5.4.210.0420.03315.37
5.4.200.0400.03115.42
5.4.190.0430.03815.48
5.4.180.0340.03715.21
5.4.170.0350.04515.42
5.4.160.0470.02615.21
5.4.150.0450.03715.43
5.4.140.0460.02614.12
5.4.130.0380.03014.03
5.4.120.0350.03314.11
5.4.110.0400.03214.11
5.4.100.0380.03214.13
5.4.90.0310.04614.13
5.4.80.0280.03614.10
5.4.70.0150.03214.09
5.4.60.0150.04014.02
5.4.50.0070.03213.92
5.4.40.0120.02314.01
5.4.30.0200.02913.92
5.4.20.0100.02313.99
5.4.10.0000.01011.60
5.4.00.0030.00711.60

preferences:
47.99 ms | 400 KiB | 5 Q