3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace App; use Generator; use CachingIterator; class Foo { static $i = 0; public function __toString() { echo "Foo::_toString called " . (self::$i + 1) . " times\n"; return "foo " . ((string) ++self::$i); } } $generator = /** * @return Generator<bool, bool> */ static function () { yield true => true; yield false => false; yield "foo" => new Foo(); yield "bar" => new Foo(); yield "baz" => new Foo(); }; $iterator = new CachingIterator($generator(), CachingIterator::FULL_CACHE | CachingIterator::CALL_TOSTRING); foreach ($iterator as $k => $v) { var_dump($k, $v); } foreach ($iterator->getCache() as $k => $v) { var_dump($k, $v); }

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.5.00.0110.01022.74
8.4.150.0010.00114.05
8.4.140.0130.00817.57
8.4.130.0130.00717.69
8.4.120.0150.00624.34
8.4.110.0120.00822.59
8.4.100.0050.00419.02
8.4.90.0050.00418.93
8.4.80.0110.00818.95
8.4.70.0130.00917.98
8.4.60.0070.01319.02
8.4.50.0050.00318.76
8.4.40.0100.01019.46
8.4.30.0120.00920.75
8.4.20.0140.00717.85
8.4.10.0090.00322.30
8.3.280.0100.01118.38
8.3.270.0120.00816.53
8.3.260.0140.00616.56
8.3.250.0080.01018.81
8.3.240.0090.00917.09
8.3.230.0080.01116.78
8.3.220.0120.00919.15
8.3.210.0030.00516.54
8.3.200.0040.00516.68
8.3.190.0070.01217.17
8.3.180.0070.00317.02
8.3.170.0120.00620.57
8.3.160.0150.00416.99
8.3.150.0060.01317.11
8.3.140.0140.00416.62
8.3.130.0060.00316.65
8.3.120.0110.00820.90
8.3.110.0030.00616.51
8.3.100.0030.00624.06
8.3.90.0100.00026.77
8.3.80.0060.00316.75
8.3.70.0140.00016.88
8.3.60.0130.01016.61
8.3.50.0140.00818.38
8.3.40.0070.00721.73
8.3.30.0070.00718.70
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0100.01020.44
8.2.280.0070.01118.63
8.2.270.0150.00917.32
8.2.260.0140.00316.39
8.2.250.0080.00018.50
8.2.240.0000.00817.30
8.2.230.0030.00620.94
8.2.220.0000.00937.54
8.2.210.0040.01126.77
8.2.200.0060.00316.50
8.2.190.0120.00916.58
8.2.180.0150.00325.92
8.2.170.0190.00322.96
8.2.160.0070.01422.96
8.2.150.0000.00725.66
8.2.140.0050.00224.66
8.2.130.0050.00326.16
8.2.120.0050.00326.16
8.2.110.0030.00620.52
8.2.100.0080.00317.78
8.2.90.0060.00317.63
8.2.80.0000.00818.04
8.2.70.0090.00017.50
8.2.60.0040.00417.75
8.2.50.0000.00818.04
8.2.40.0040.00419.95
8.2.30.0040.00418.23
8.2.20.0040.00420.49
8.2.10.0040.00418.10
8.2.00.0000.00719.32
8.1.330.0110.00721.75
8.1.320.0070.00216.37
8.1.310.0090.00916.77
8.1.300.0030.00620.03
8.1.290.0090.00030.84
8.1.280.0110.00425.92
8.1.270.0030.00623.85
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.97
8.1.230.0090.00320.73
8.1.220.0090.00017.74
8.1.210.0050.00318.77
8.1.200.0060.00317.36
8.1.190.0050.00317.23
8.1.180.0030.00518.10
8.1.170.0040.00417.66
8.1.160.0000.00718.89
8.1.150.0040.00418.66
8.1.140.0000.00717.46
8.1.130.0070.00018.89
8.1.120.0000.00717.52
8.1.110.0090.00017.42
8.1.100.0040.00417.38
8.1.90.0050.00317.39
8.1.80.0060.00817.40
8.1.70.0100.00717.39
8.1.60.0180.00317.43
8.1.50.0150.00617.44
8.1.40.0130.00817.39
8.1.30.0170.00317.55
8.1.20.0150.00417.59
8.1.10.0120.00617.27
8.1.00.0130.00417.18
8.0.300.0080.00021.64
8.0.290.0040.00416.63
8.0.280.0050.00318.45
8.0.270.0030.00516.88
8.0.260.0030.00318.36
8.0.250.0030.00316.86
8.0.240.0000.00716.93
8.0.230.0060.00316.95
8.0.220.0030.00416.93
8.0.210.0060.00916.40
8.0.200.0120.00316.56
8.0.190.0110.00416.70
8.0.180.0100.00616.72
8.0.170.0090.00616.54
8.0.160.0110.00316.65
8.0.150.0080.00716.61
8.0.140.0090.00616.58
8.0.130.0130.00116.66
8.0.120.0060.00916.74
8.0.110.0130.00216.58
8.0.100.0090.00516.53
8.0.90.0090.00516.59
8.0.80.0080.00616.63
8.0.70.0110.00516.75
8.0.60.0120.00316.64
8.0.50.0120.00216.60
8.0.30.0100.00516.66
8.0.20.0100.00516.78
8.0.10.0000.01316.83
8.0.00.0040.01016.97
7.4.330.0000.00515.55
7.4.320.0030.00316.45
7.4.300.0090.00516.42
7.4.290.0060.00516.38
7.4.280.0070.00616.23
7.4.270.0080.00416.31
7.4.260.0060.00616.29
7.4.250.0060.00816.34
7.4.240.0060.00516.46
7.4.230.0090.00316.36
7.4.220.0110.00116.40
7.4.210.0070.00516.39
7.4.200.0090.00416.34
7.4.190.0110.00216.32
7.4.180.0040.00816.26
7.4.160.0080.00416.39
7.4.150.0070.00616.23
7.4.140.0100.00316.39
7.4.130.0090.00316.34
7.4.120.0090.00316.33
7.4.110.0080.00416.07
7.4.100.0090.00216.35
7.4.90.0060.00516.18
7.4.80.0070.00516.23
7.4.70.0050.00716.18
7.4.60.0080.00416.28
7.4.50.0090.00416.09
7.4.40.0070.00516.37
7.4.30.0100.00216.29
7.4.20.0070.00516.30
7.4.10.0100.00216.34
7.4.00.0090.00416.09
7.3.330.0110.00616.16
7.3.320.0140.00216.37
7.3.310.0110.00416.16
7.3.300.0120.00316.27
7.3.290.0120.00516.14
7.3.280.0110.00516.24
7.3.270.0130.00216.32
7.3.260.0090.00816.09
7.3.250.0140.00316.09
7.3.240.0180.00016.14
7.3.230.0160.00016.30
7.3.220.0100.00716.26
7.3.210.0120.00316.25
7.3.200.0160.00016.24
7.3.190.0130.00316.17
7.3.180.0130.00316.23
7.3.170.0110.00516.20
7.3.160.0100.00616.22
7.3.150.0130.00316.08
7.3.140.0150.00016.18
7.3.130.0110.00516.05
7.3.120.0150.00016.17
7.3.110.0120.00616.07
7.3.100.0110.00616.18
7.3.90.0120.00416.33
7.3.80.0160.00016.16
7.3.70.0090.00616.39
7.3.60.0110.00616.39
7.3.50.0110.00516.37
7.3.40.0070.00716.48
7.3.30.0110.00416.20
7.3.20.0160.00018.21
7.3.10.0140.00317.99
7.3.00.0110.00418.01
7.2.340.0100.00816.38
7.2.330.0100.00716.32
7.2.320.0170.00016.23
7.2.310.0100.00716.29
7.2.300.0110.00516.24
7.2.290.0100.00816.43
7.2.280.0040.01216.43
7.2.270.0100.00616.29
7.2.260.0110.00516.28
7.2.250.0140.00316.28
7.2.240.0120.00516.46
7.2.230.0100.00816.32
7.2.220.0080.00816.44
7.2.210.0170.00016.47
7.2.200.0080.01116.62
7.2.190.0080.00816.55
7.2.180.0110.00516.44
7.2.170.0120.00316.45
7.2.160.0080.00816.47
7.2.150.0040.01218.41
7.2.140.0050.01118.47
7.2.130.0120.00518.58
7.2.120.0160.00018.38
7.2.110.0120.00418.55
7.2.100.0130.00318.40
7.2.90.0100.00618.28
7.2.80.0160.00018.29
7.2.70.0100.00718.27
7.2.60.0080.00818.41
7.2.50.0160.00018.50
7.2.40.0120.00418.37
7.2.30.0080.00818.51
7.2.20.0140.00218.46
7.2.10.0180.00018.36
7.2.00.0140.00318.34
7.1.330.0090.00617.27
7.1.320.0120.00417.27
7.1.310.0110.00417.20
7.1.300.0120.00317.34
7.1.290.0110.00317.34
7.1.280.0130.00317.35
7.1.270.0140.00017.23
7.1.260.0140.00217.26
7.1.250.0100.00717.05
7.1.240.0070.00817.25
7.1.230.0160.00017.28
7.1.220.0020.01217.16
7.1.210.0120.00317.14
7.1.200.0120.00317.08
7.1.190.0150.00017.28
7.1.180.0050.00917.24
7.1.170.0070.00717.21
7.1.160.0050.01017.27
7.1.150.0130.00017.09
7.1.140.0110.00317.27
7.1.130.0110.00317.29
7.1.120.0130.00017.26
7.1.110.0130.00017.05
7.1.100.0070.00717.04
7.1.90.0150.00017.25
7.1.80.0100.00517.24
7.1.70.0100.00317.12
7.1.60.0150.00017.16
7.1.50.0140.00017.36
7.1.40.0000.01417.38
7.1.30.0090.00517.11
7.1.20.0100.00317.28
7.1.10.0120.00217.29
7.1.00.0000.01417.25
7.0.330.0090.00516.90
7.0.320.0070.00616.84
7.0.310.0070.00717.04
7.0.300.0060.00717.01
7.0.290.0140.00016.82
7.0.280.0120.00216.92
7.0.270.0090.00516.95
7.0.260.0090.00516.86
7.0.250.0090.00417.00
7.0.240.0130.00017.23
7.0.230.0070.00717.18
7.0.220.0140.00016.89
7.0.210.0070.00717.12
7.0.200.0080.00416.93
7.0.190.0140.00017.07
7.0.180.0070.00716.93
7.0.170.0100.00316.91
7.0.160.0080.00616.77
7.0.150.0100.00416.97
7.0.140.0100.00316.77
7.0.130.0080.00517.15
7.0.120.0120.00217.08
7.0.110.0140.00016.79
7.0.100.0140.00017.04
7.0.90.0080.00516.84
7.0.80.0090.00516.78
7.0.70.0030.01016.90
7.0.60.0100.00316.84
7.0.50.0100.00316.80
7.0.40.0090.00316.93
7.0.30.0130.00016.92
7.0.20.0130.00017.05
7.0.10.0110.00316.86
7.0.00.0110.00217.00
5.6.400.0130.00015.79
5.6.390.0130.00015.75
5.6.380.0090.00415.63
5.6.370.0110.00315.83
5.6.360.0130.00015.61
5.6.350.0090.00315.79
5.6.340.0100.00315.84
5.6.330.0090.00515.84
5.6.320.0100.00315.78
5.6.310.0050.00915.91
5.6.300.0040.00915.74
5.6.290.0130.00015.70
5.6.280.0070.00715.86
5.6.270.0040.00915.76
5.6.260.0080.00515.88
5.6.250.0060.00615.93
5.6.240.0040.00915.80
5.6.230.0100.00315.89
5.6.220.0040.01016.00
5.6.210.0130.00015.89
5.6.200.0090.00316.06
5.6.190.0040.00915.98
5.6.180.0130.00015.71
5.6.170.0100.00316.05
5.6.160.0100.00316.06
5.6.150.0050.00815.97
5.6.140.0090.00415.94
5.6.130.0060.00615.97
5.6.120.0100.00316.00
5.6.110.0030.00915.82
5.6.100.0040.00815.93
5.6.90.0080.00515.74
5.6.80.0100.00315.82
5.6.70.0000.01315.99
5.6.60.0060.00615.88
5.6.50.0100.00315.78
5.6.40.0130.00015.79
5.6.30.0130.00015.74
5.6.20.0080.00515.74
5.6.10.0040.00815.62
5.6.00.0080.00415.79
5.5.380.0070.00715.81
5.5.370.0060.00915.88
5.5.360.0080.00515.86
5.5.350.0090.00315.82
5.5.340.0060.00615.69
5.5.330.0130.00015.83
5.5.320.0090.00515.66
5.5.310.0090.00415.66
5.5.300.0070.00715.68
5.5.290.0100.00315.89
5.5.280.0080.00515.69
5.5.270.0100.00315.88
5.5.260.0130.00015.57
5.5.250.0100.00315.73
5.5.240.0100.00315.86
5.5.230.0130.00015.79
5.5.220.0140.00015.82
5.5.210.0080.00415.86
5.5.200.0100.00315.53
5.5.190.0130.00015.57
5.5.180.0040.00915.77
5.5.170.0070.00515.61
5.5.160.0070.00715.77
5.5.150.0080.00415.61
5.5.140.0100.00315.59
5.5.130.0120.00015.50
5.5.120.0060.00615.42
5.5.110.0000.01215.41
5.5.100.0100.00315.82
5.5.90.0030.01015.89
5.5.80.0050.00815.66
5.5.70.0030.01015.96
5.5.60.0040.00915.70
5.5.50.0120.00015.64
5.5.40.0080.00415.93
5.5.30.0040.00815.80
5.5.20.0120.00015.78
5.5.10.0040.00815.80
5.5.00.0060.00615.85
5.4.450.0100.00012.39
5.4.440.0100.00012.27
5.4.430.0080.00312.40
5.4.420.0100.00012.41
5.4.410.0100.00012.48
5.4.400.0000.01012.35
5.4.390.0050.00512.35
5.4.380.0070.00412.21
5.4.370.0080.00312.34
5.4.360.0120.00012.13
5.4.350.0110.00012.49
5.4.340.0050.00512.32
5.4.330.0040.00812.37
5.4.320.0060.00612.38
5.4.310.0080.00412.58
5.4.300.0040.00912.40
5.4.290.0110.00012.53
5.4.280.0120.00212.27
5.4.270.0030.00912.40
5.4.260.0060.00612.46
5.4.250.0100.00212.34
5.4.240.0120.00012.21
5.4.230.0090.00312.14
5.4.220.0100.00012.12
5.4.210.0100.00212.03
5.4.200.0080.00312.02
5.4.190.0080.00511.93
5.4.180.0120.00011.98
5.4.170.0110.00012.04
5.4.160.0120.00012.37
5.4.150.0120.00012.19
5.4.140.0070.00312.31
5.4.130.0060.00612.35
5.4.120.0060.00612.55
5.4.110.0050.00712.48
5.4.100.0120.00012.39
5.4.90.0090.00212.22
5.4.80.0080.00312.29
5.4.70.0080.00312.54
5.4.60.0050.00512.33
5.4.50.0110.00012.32
5.4.40.0080.00312.48
5.4.30.0080.00412.36
5.4.20.0050.00512.27
5.4.10.0040.00712.54
5.4.00.0110.00012.05
5.3.290.0060.00612.64
5.3.280.0000.01012.74
5.3.270.0050.00512.57
5.3.260.0100.00012.81
5.3.250.0030.00912.80
5.3.240.0090.00412.45
5.3.230.0100.00312.53
5.3.220.0080.00412.54
5.3.210.0090.00212.54
5.3.200.0100.00312.75
5.3.190.0060.00712.83
5.3.180.0060.00612.95
5.3.170.0060.00612.74
5.3.160.0030.00912.76
5.3.150.0050.00212.71
5.3.140.0060.00612.87
5.3.130.0080.00512.93
5.3.120.0100.00312.88
5.3.110.0100.00312.93
5.3.100.0080.00412.64
5.3.90.0090.00312.85
5.3.80.0070.00512.57
5.3.70.0080.00312.76
5.3.60.0040.00812.66
5.3.50.0120.00012.78
5.3.40.0080.00412.56
5.3.30.0120.00012.55
5.3.20.0060.00512.68
5.3.10.0060.00612.63
5.3.00.0130.00012.58
5.2.170.0070.00411.87
5.2.160.0080.00211.91
5.2.150.0110.00011.79
5.2.140.0090.00211.71
5.2.130.0090.00211.81
5.2.120.0050.00511.51
5.2.110.0070.00311.81
5.2.100.0000.01011.86
5.2.90.0090.00011.62
5.2.80.0050.00611.54
5.2.70.0060.00311.45
5.2.60.0100.00011.66
5.2.50.0060.00411.62
5.2.40.0070.00311.77
5.2.30.0030.00611.71
5.2.20.0040.00411.59
5.2.10.0100.00011.30
5.2.00.0060.00311.46
5.1.60.0040.00410.54
5.1.50.0090.00010.63
5.1.40.0080.00010.97
5.1.30.0050.00310.78
5.1.20.0000.00910.91
5.1.10.0060.00310.82
5.1.00.0040.00410.64
5.0.50.0070.00010.20
5.0.40.0030.00310.00
5.0.30.0000.0069.71
5.0.20.0000.0069.64
5.0.10.0060.0009.57
5.0.00.0030.0039.54
4.4.90.0040.0009.54
4.4.80.0040.0009.54
4.4.70.0040.0009.54
4.4.60.0020.0029.54
4.4.50.0040.0009.54
4.4.40.0000.0049.54
4.4.30.0000.0049.54
4.4.20.0000.0049.54
4.4.10.0000.0049.54
4.4.00.0040.0009.54
4.3.110.0040.0009.54
4.3.100.0000.0039.54
4.3.90.0000.0049.54
4.3.80.0000.0049.54
4.3.70.0000.0049.54
4.3.60.0000.0049.54
4.3.50.0020.0029.54
4.3.40.0020.0029.54
4.3.30.0000.0039.54
4.3.20.0000.0039.54
4.3.10.0000.0039.54
4.3.00.0020.0009.54

preferences:
181.35 ms | 403 KiB | 5 Q