3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* A tasks job is to count from 0 to $limit */ class Task { public function __construct($limit) { $this->limit = ($limit + 1) * 100; } public function doWork($async) { if ($async) { /* do a little work and allow another task to continue */ $this->position++; } else { /* do all the work */ for (; $this->position < $this->limit; $this->position++); } } public function hasWork() { return $this->position <= $this->limit; } public function getPosition() { return $this->position; } private $position = 0; private $limit = 0; } /* helper for detecting completion */ function finished($tasks) { foreach ($tasks as $task) { if ($task->hasWork()) return false; } return true; } /* helper for printing positions */ function positions($tasks, $numeric = false) { $positions = []; foreach ($tasks as $task) { $positions[] = $numeric || $task->hasWork() ? $task->getPosition() : "-"; } return $positions; } /* create three tasks */ $tasks = array( new Task(0), new Task(1), new Task(2) ); /* execute tasks asynchronously */ while (!finished($tasks)) { foreach ($tasks as $task) { if ($task->hasWork()) { $task->doWork(true); } vprintf( "% 4s % 4s % 4s\n", positions($tasks)); } } printf("------------------\n"); $tasks = array( new Task(0), new Task(1), new Task(2) ); /* execute tasks synchronously */ foreach ($tasks as $task) { if ($task->hasWork()) { $task->doWork(false); } vprintf( "% 4s % 4s % 4s\n", positions($tasks)); } ?>

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.0180.00618.18
8.3.50.0200.00522.05
8.3.40.0130.01318.90
8.3.30.0090.01219.21
8.3.20.0030.00620.25
8.3.10.0060.00320.53
8.3.00.0060.00318.05
8.2.180.0190.00316.75
8.2.170.0100.00722.96
8.2.160.0130.00320.22
8.2.150.0060.01624.18
8.2.140.0060.00324.66
8.2.130.0090.00026.16
8.2.120.0030.00722.23
8.2.110.0040.00822.25
8.2.100.0070.00717.72
8.2.90.0060.00319.30
8.2.80.0000.00917.97
8.2.70.0030.00717.63
8.2.60.0030.00717.80
8.2.50.0000.01018.07
8.2.40.0030.00618.16
8.2.30.0030.00719.55
8.2.20.0030.00617.87
8.2.10.0030.00618.24
8.2.00.0060.00317.82
8.1.280.0140.00725.92
8.1.270.0040.00423.95
8.1.260.0000.00926.35
8.1.250.0060.00328.09
8.1.240.0160.00323.98
8.1.230.0040.00819.29
8.1.220.0100.00017.86
8.1.210.0030.00618.77
8.1.200.0070.00717.25
8.1.190.0000.00917.25
8.1.180.0040.00418.10
8.1.170.0040.00418.84
8.1.160.0050.00322.09
8.1.150.0030.00618.82
8.1.140.0000.00917.43
8.1.130.0050.00318.02
8.1.120.0030.00617.50
8.1.110.0000.00917.41
8.1.100.0030.00617.49
8.1.90.0080.00017.55
8.1.80.0080.00017.54
8.1.70.0040.00417.34
8.1.60.0000.01017.66
8.1.50.0060.00317.62
8.1.40.0040.00417.58
8.1.30.0000.01017.61
8.1.20.0030.00617.72
8.1.10.0060.00317.50
8.1.00.0000.00917.54
8.0.300.0030.00620.65
8.0.290.0030.00616.75
8.0.280.0040.00418.57
8.0.270.0080.00017.33
8.0.260.0040.00417.30
8.0.250.0020.00517.07
8.0.240.0050.00317.03
8.0.230.0000.00816.89
8.0.220.0040.00416.87
8.0.210.0040.00416.87
8.0.200.0070.00016.99
8.0.190.0060.00317.06
8.0.180.0000.00916.87
8.0.170.0050.00516.86
8.0.160.0090.00017.00
8.0.150.0030.00616.95
8.0.140.0040.00416.80
8.0.130.0070.00013.43
8.0.120.0000.00916.93
8.0.110.0030.00616.86
8.0.100.0030.00616.97
8.0.90.0000.00916.90
8.0.80.0070.01116.96
8.0.70.0030.00616.76
8.0.60.0060.00317.02
8.0.50.0030.00616.81
8.0.30.0140.01316.97
8.0.20.0120.01417.40
8.0.10.0080.00017.03
8.0.00.0160.02217.09
7.4.330.0000.00715.01
7.4.320.0000.00816.71
7.4.300.0000.00816.46
7.4.290.0060.00316.52
7.4.280.0030.00616.65
7.4.270.0000.00916.55
7.4.260.0040.00416.59
7.4.250.0030.00616.66
7.4.240.0040.00416.69
7.4.230.0040.00416.73
7.4.220.0210.01416.54
7.4.210.0100.01016.70
7.4.200.0040.00416.66
7.4.160.0170.01716.52
7.4.150.0140.01417.40
7.4.140.0090.01617.86
7.4.130.0150.01316.64
7.4.120.0130.01016.50
7.4.110.0230.01116.61
7.4.100.0110.01516.55
7.4.90.0100.01416.41
7.4.80.0140.01016.64
7.4.70.0100.01016.61
7.4.60.0150.01016.58
7.4.50.0070.00316.39
7.4.40.0150.01416.68
7.4.30.0070.01416.82
7.4.10.0120.00614.67
7.4.00.0060.01314.97
7.3.330.0050.00213.26
7.3.320.0000.00713.26
7.3.310.0030.00716.29
7.3.300.0040.00416.40
7.3.290.0030.02216.42
7.3.280.0100.01416.40
7.3.270.0170.01017.40
7.3.260.0130.01516.43
7.3.250.0120.01416.51
7.3.240.0120.01516.64
7.3.230.0130.01016.48
7.3.210.0080.02216.42
7.3.200.0180.01219.39
7.3.190.0150.01116.38
7.3.180.0070.01516.53
7.3.170.0100.01316.56
7.3.160.0030.01616.64
7.3.130.0150.00614.88
7.3.120.0130.00615.14
7.3.110.0070.01414.80
7.3.100.0070.01114.57
7.3.90.0100.00614.95
7.3.80.0100.00314.66
7.3.70.0030.01414.95
7.3.60.0030.01414.89
7.3.50.0040.00714.93
7.3.40.0090.00914.77
7.3.30.0030.01314.64
7.3.20.0130.00616.76
7.3.10.0030.01016.27
7.3.00.0110.00716.47
7.2.330.0140.01216.64
7.2.320.0140.01216.90
7.2.310.0160.01016.55
7.2.300.0210.00516.67
7.2.290.0120.00816.52
7.2.260.0100.01015.07
7.2.250.0030.01815.06
7.2.240.0070.01015.06
7.2.230.0100.01014.77
7.2.220.0040.01415.05
7.2.210.0150.00315.13
7.2.200.0060.00915.14
7.2.190.0040.01115.06
7.2.180.0030.01615.04
7.2.170.0030.01515.22
7.2.160.0030.01014.97
7.2.150.0120.00316.93
7.2.140.0130.00016.96
7.2.130.0030.01316.75
7.2.120.0030.01017.00
7.2.110.0040.01816.93
7.2.100.0150.00417.02
7.2.90.0030.01416.81
7.2.80.0130.00616.88
7.2.70.0040.01516.85
7.2.60.0060.00917.11
7.2.50.0030.01416.92
7.2.40.0090.00916.93
7.2.30.0040.01216.94
7.2.20.0000.01816.95
7.2.10.0060.00616.96
7.2.00.0030.01416.87
7.1.330.0070.01115.75
7.1.320.0080.00415.90
7.1.310.0070.01015.96
7.1.300.0030.01715.82
7.1.290.0080.00615.69
7.1.280.0110.00715.81
7.1.270.0060.00615.83
7.1.260.0030.01415.95
7.1.250.0100.00715.85
7.1.240.0120.00616.02
7.1.230.0070.01415.98
7.1.220.0040.00815.78
7.1.210.0140.00315.94
7.1.200.0110.00715.57
7.1.190.0060.00815.46
7.1.180.0070.00715.83
7.1.170.0120.00415.87
7.1.160.0080.00415.80
7.1.150.0000.01815.73
7.1.140.0040.01416.02
7.1.130.0060.00615.61
7.1.120.0090.00615.91
7.1.110.0000.01115.80
7.1.100.0060.00615.75
7.1.90.0130.00315.98
7.1.80.0030.01015.56
7.1.70.0090.00616.47
7.1.60.0130.01017.50
7.1.50.0100.00516.37
7.1.40.0000.01815.84
7.1.30.0060.01015.86
7.1.20.0040.01515.82
7.1.10.0070.00715.81
7.1.00.0030.04519.03
7.0.330.0080.00615.46
7.0.320.0070.00715.25
7.0.310.0130.00315.46
7.0.300.0110.00615.47
7.0.290.0150.00615.33
7.0.280.0040.01215.17
7.0.270.0070.00415.41
7.0.260.0070.00715.64
7.0.250.0100.00715.20
7.0.240.0160.00015.15
7.0.230.0040.01515.26
7.0.220.0070.01015.45
7.0.210.0030.00715.45
7.0.200.0030.00816.10
7.0.190.0060.01115.50
7.0.180.0060.01015.44
7.0.170.0030.01215.58
7.0.160.0040.00815.23
7.0.150.0100.00715.45
7.0.140.0070.04418.79
7.0.130.0060.01215.29
7.0.120.0070.01015.50
7.0.110.0000.02015.41
7.0.100.0030.01615.52
7.0.90.0000.01615.48
7.0.80.0070.01015.51
7.0.70.0040.01215.20
7.0.60.0090.02117.67
7.0.50.0120.03916.72
7.0.40.0100.04916.90
7.0.30.0250.04516.85
7.0.20.0180.03016.81
7.0.10.0050.03716.86
7.0.00.0100.02516.83
5.6.400.0060.01514.80
5.6.390.0030.01214.74
5.6.380.0100.01014.94
5.6.370.0030.01814.71
5.6.360.0090.00914.52
5.6.350.0000.01514.90
5.6.340.0000.02014.51
5.6.330.0060.00914.75
5.6.320.0140.00314.58
5.6.310.0030.01614.42
5.6.300.0160.00614.73
5.6.290.0030.01814.39
5.6.280.0020.04817.77
5.6.270.0030.01714.38
5.6.260.0040.01814.36
5.6.250.0030.01714.44
5.6.240.0040.01214.23
5.6.230.0030.01914.44
5.6.220.0170.00714.33
5.6.210.0070.05217.54
5.6.200.0030.02916.33
5.6.190.0030.03517.54
5.6.180.0330.03317.46
5.6.170.0200.04917.64
5.6.160.0080.05017.41
5.6.150.0050.04716.35
5.6.140.0050.05316.46
5.6.130.0070.05516.24
5.6.120.0100.02817.69
5.6.110.0130.04517.75
5.6.100.0090.03017.79
5.6.90.0100.02717.77
5.6.80.0030.03117.48
5.6.70.0210.00314.38
5.6.60.0150.00914.31
5.6.50.0100.01014.36
5.6.40.0000.01814.59
5.6.30.0070.01714.30
5.6.20.0030.02114.47
5.6.10.0070.01014.33
5.6.00.0060.00814.30
5.5.380.0060.01314.51
5.5.370.0070.01014.45
5.5.360.0070.01114.43
5.5.350.0150.04517.59
5.5.340.0080.03816.37
5.5.330.0080.04917.41
5.5.320.0250.02317.38
5.5.310.0170.02717.36
5.5.300.0080.04216.08
5.5.290.0070.05116.23
5.5.280.0120.04917.71
5.5.270.0100.04817.76
5.5.260.0100.04817.56
5.5.250.0030.03317.48
5.5.240.0070.05017.46
5.5.230.0090.01514.68
5.5.220.0110.01114.43
5.5.210.0030.01914.25
5.5.200.0100.01314.09
5.5.190.0110.01114.51
5.5.180.0000.01414.43
5.5.170.0100.01014.41
5.5.160.0070.01114.51
5.5.150.0070.01414.35
5.5.140.0030.01314.07
5.5.130.0070.01114.59
5.5.120.0150.00614.06
5.5.110.0080.01214.20
5.5.100.0030.01614.42
5.5.90.0100.01014.48
5.5.80.0030.01314.49
5.5.70.0080.01214.46
5.5.60.0060.00914.24
5.5.50.0040.01414.07
5.5.40.0070.01714.55
5.5.30.0090.00914.37
5.5.20.0070.01014.60
5.5.10.0030.01414.11
5.5.00.0040.01114.17
5.4.450.0120.04216.48
5.4.440.0100.04316.30
5.4.430.0050.04316.29
5.4.420.0050.04516.50
5.4.410.0120.03716.33
5.4.400.0150.03416.34
5.4.390.0170.03216.23
5.4.380.0250.03115.98
5.4.370.0270.04015.97
5.4.360.0250.03216.09
5.4.350.0250.03516.08
5.4.340.0130.04016.11
5.4.330.0120.00613.40
5.4.320.0080.02812.96
5.4.310.0060.03112.96
5.4.300.0080.02912.96
5.4.290.0100.02912.96
5.4.280.0070.02912.91
5.4.270.0080.02412.91
5.4.260.0090.02612.91
5.4.250.0090.02612.91
5.4.240.0070.02812.91
5.4.230.0080.02412.90
5.4.220.0070.02412.90
5.4.210.0070.02712.90
5.4.200.0080.02612.90
5.4.190.0090.02412.90
5.4.180.0070.02612.90
5.4.170.0100.02212.91
5.4.160.0060.02412.90
5.4.150.0080.02512.90
5.4.140.0050.02912.74
5.4.130.0100.02512.74
5.4.120.0100.02512.71
5.4.110.0070.02712.71
5.4.100.0090.02412.71
5.4.90.0070.02612.71
5.4.80.0040.02712.71
5.4.70.0040.02912.71
5.4.60.0070.02612.71
5.4.50.0070.02612.71
5.4.40.0040.02812.71
5.4.30.0070.02612.71
5.4.20.0100.02512.71
5.4.10.0110.02312.71
5.4.00.0060.02812.45
5.3.290.0070.04512.80
5.3.280.0110.03312.71
5.3.270.0030.04612.72
5.3.260.0060.04212.72
5.3.250.0080.03612.72
5.3.240.0040.04012.72
5.3.230.0070.03612.71
5.3.220.0070.03912.68
5.3.210.0070.04212.68
5.3.200.0070.03412.68
5.3.190.0070.03612.68
5.3.180.0050.03712.68
5.3.170.0060.03612.67
5.3.160.0060.03612.68
5.3.150.0060.04912.67
5.3.140.0070.03912.66
5.3.130.0070.03712.66
5.3.120.0030.04112.66
5.3.110.0050.03912.66
5.3.100.0040.03812.14
5.3.90.0040.03812.12
5.3.80.0070.03412.10
5.3.70.0050.03712.11
5.3.60.0040.03812.09
5.3.50.0060.03512.04
5.3.40.0090.03812.04
5.3.30.0080.03812.00
5.3.20.0080.03311.78
5.3.10.0080.04411.75
5.3.00.0050.03711.73
5.2.170.0060.0299.24
5.2.160.0080.0269.23
5.2.150.0030.0329.23
5.2.140.0040.0309.23
5.2.130.0050.0299.19
5.2.120.0040.0299.20
5.2.110.0060.0289.20
5.2.100.0080.0289.20
5.2.90.0080.0259.19
5.2.80.0080.0349.19
5.2.70.0010.0389.19
5.2.60.0050.0339.15
5.2.50.0070.0289.11
5.2.40.0040.0309.09
5.2.30.0050.0299.07
5.2.20.0040.0299.05
5.2.10.0070.0268.96
5.2.00.0030.0318.82
5.1.60.0030.0258.11
5.1.50.0030.0268.11
5.1.40.0020.0268.08
5.1.30.0030.0268.43
5.1.20.0050.0338.46
5.1.10.0050.0278.18
5.1.00.0070.0228.19
5.0.50.0030.0226.66
5.0.40.0040.0186.52
5.0.30.0040.0306.33
5.0.20.0020.0206.30
5.0.10.0040.0236.28
5.0.00.0050.0306.27
4.4.90.0010.0164.78
4.4.80.0030.0164.75
4.4.70.0040.0144.75
4.4.60.0030.0144.76
4.4.50.0030.0164.77
4.4.40.0030.0264.71
4.4.30.0040.0184.76
4.4.20.0020.0154.85
4.4.10.0040.0144.85
4.4.00.0020.0334.76
4.3.110.0030.0154.67
4.3.100.0030.0144.66
4.3.90.0020.0164.64
4.3.80.0060.0294.58
4.3.70.0050.0154.63
4.3.60.0020.0154.63
4.3.50.0030.0214.63
4.3.40.0010.0294.54
4.3.30.0020.0203.30
4.3.20.0000.0223.28
4.3.10.0020.0193.23
4.3.00.0030.0306.76

preferences:
42.28 ms | 401 KiB | 5 Q