3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { function __construct($c) { $this->count = $c; } function getPrev() { return $this->prev; } function setPrev($pr) { $this->prev = $pr; } function getNext() { return $this->next; } function setNext($nxt) { $this->next = $nxt; } function shout($shout, $nth) { if ($shout < $nth) { return $shout + 1; } $this->getPrev()->setNext($this->getNext()); $this->getNext()->setPrev($this->getPrev()); return 1; } } class Chain { var $first; function __construct($size) { for($i = 0; $i < $size ; $i++) { $current = new Person($i); if ($this->first == null) $this->first = $current; if ($last != null) { $last->setNext($current); $current->setPrev($last); } $last = $current; } $this->first->setPrev($last); $last->setNext($this->first); } function kill($nth) { $current = $this->first; $shout = 1; while($current->getNext() !== $current) { $shout = $current->shout($shout,$nth); $current = $current->getNext(); } $this->first = $current; } } $start = microtime(true); $ITER = 100000; for($i = 0 ; $i < $ITER ; $i++) { $chain = new Chain(40); $chain->kill(3); } $end = microtime(true); printf("Time per iteration = %3.2f microsecondsnr",(($end - $start) * 1000000 / $ITER));

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.3.120.0030.04314.99
7.3.110.0030.03815.04
7.3.100.0070.03314.86
7.3.90.0000.03815.25
7.3.80.0030.04015.13
7.3.70.0030.03315.16
7.3.60.0100.02915.09
7.3.50.0030.03414.86
7.3.40.0030.03615.12
7.3.30.0030.03515.02
7.3.20.0070.03316.79
7.3.10.0000.03616.68
7.3.00.0140.02716.42
7.2.240.0060.04215.44
7.2.230.0000.04214.74
7.2.220.0030.03714.86
7.2.210.0100.03514.80
7.2.200.0000.03915.26
7.2.190.0000.04615.33
7.2.180.0070.03914.97
7.2.170.0070.03615.09
7.2.160.0130.02515.13
7.2.150.0030.03916.93
7.2.140.0070.03716.96
7.2.130.0070.03316.80
7.2.120.0070.03916.98
7.2.110.0030.04616.83
7.2.100.0070.03916.49
7.2.90.0070.03616.57
7.2.80.0100.03016.91
7.2.70.0070.03616.86
7.2.60.0070.03816.87
7.2.50.0030.03916.86
7.2.40.0070.04116.69
7.2.30.0030.04116.80
7.2.20.0030.03416.87
7.2.10.0070.03716.93
7.2.00.0080.03117.96
7.1.330.0070.04815.70
7.1.320.0060.04816.05
7.1.310.0030.06015.74
7.1.300.0070.05515.86
7.1.290.0130.04315.62
7.1.280.0070.05215.64
7.1.270.0100.04915.64
7.1.260.0000.05915.86
7.1.250.0070.04615.52
7.1.70.0000.02817.26
7.1.60.0100.05919.40
7.1.50.0300.04634.97
7.1.00.0000.11722.38
7.0.201.0630.03614.96
7.0.140.0070.10722.17
7.0.60.0130.09320.24
7.0.50.0100.07018.05
7.0.40.0100.11319.90
7.0.30.0270.07019.84
7.0.20.0370.09319.98
7.0.10.0030.06319.72
7.0.00.0030.11320.01
5.6.280.0100.14321.54
5.6.210.0070.14720.99
5.6.200.0130.10718.55
5.6.190.0070.10320.71
5.6.180.0170.08720.77
5.6.170.0200.11720.83
5.6.160.0130.08720.63
5.6.150.0030.09018.63
5.6.140.0030.09318.62
5.6.130.0130.14018.52
5.6.120.0170.09321.38
5.6.110.0170.13021.43
5.6.100.0070.10321.49
5.6.90.0000.09021.37
5.6.80.0130.12320.68
5.5.350.0070.11320.78
5.5.340.0100.11718.39
5.5.330.0030.15320.57
5.5.320.0470.11320.60
5.5.310.0270.08320.60
5.5.300.0100.14018.44
5.5.290.0100.13718.44
5.5.280.0070.09021.18
5.5.270.0130.14321.20
5.5.260.0200.11321.20
5.5.250.0300.13720.90
5.5.240.0200.08720.77
5.4.450.0230.12719.75
5.4.440.0400.12719.96
5.4.430.0300.13019.75
5.4.420.0400.11719.89
5.4.410.0230.14019.84
5.4.400.0330.12719.42
5.4.390.4370.09019.40
5.4.380.0230.12019.33
5.4.370.0470.12319.29
5.4.360.0330.12319.21
5.4.350.0400.13719.40
5.4.340.0300.09319.40
5.4.320.0120.10212.90
5.4.310.0130.10412.89
5.4.300.0100.10912.90
5.4.290.0070.11012.89
5.4.280.0120.10612.79
5.4.270.0130.11012.79
5.4.260.0110.11112.79
5.4.250.0140.14312.80
5.4.240.0050.11312.80
5.4.230.0120.10612.79
5.4.220.0100.14812.79
5.4.210.0120.12912.79
5.4.200.0100.11912.79
5.4.190.0100.13612.78
5.4.180.0150.10012.78
5.4.170.0060.11912.79
5.4.160.0060.10912.79
5.4.150.0110.10912.78
5.4.140.0100.10412.47
5.4.130.0090.10612.46
5.4.120.0100.11412.42
5.4.110.0060.10512.41
5.4.100.0080.10212.41
5.4.90.0080.10212.41
5.4.80.0070.12512.41
5.4.70.0110.13512.40
5.4.60.0080.10912.41
5.4.50.0090.09912.41
5.4.40.0090.09812.39
5.4.30.0060.10412.39
5.4.20.0140.09812.39
5.4.10.0070.10312.39
5.4.00.0120.12111.87

preferences:
30.79 ms | 400 KiB | 5 Q