3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<pre>"; $results = array( "m1" => 0, "m2" => 0 ); $repeat = 1000; for($i = 0; $i < $repeat; $i ++) { foreach($results as $k => $no) { $results[$k] += $k($repeat); } if ($i == 0) { printf("First Run\n%s\n\n", json_encode($results, 128)); } } printf("100 Runs\n%s\n", json_encode($results, 128)); function m1($x) { $data = array(); $collision = 0; for($i = 0; $i < $x; $i ++) { $n = (rand() ^ (rand() / getrandmax())) % 256; isset($data[$n]) and $collision ++; $data[$n] = true; } return $collision; } function m2($x) { $data = array(); $collision = 0; for($i = 0; $i < $x; $i ++) { $n = (rand() ^ rand()) % 256; isset($data[$n]) and $collision ++; $data[$n] = true; } return $collision; } ?>

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.1.70.0070.27017.18
7.1.60.0200.21719.40
7.1.50.0170.24034.51
7.1.00.0030.34022.51
7.0.200.0030.23816.50
7.0.140.0000.36322.08
7.0.120.0070.33722.05
7.0.90.0130.30020.18
7.0.80.0030.30719.95
7.0.70.0030.34319.89
7.0.60.0030.32019.96
7.0.50.0500.29020.27
7.0.40.0530.29320.19
7.0.30.0100.29720.18
7.0.20.0070.29720.08
7.0.10.0100.30020.17
7.0.00.0070.31720.04
5.6.280.0030.55320.85
5.6.240.0070.57320.73
5.6.230.0070.45720.78
5.6.220.0100.51320.77
5.6.210.0030.46020.52
5.6.200.0170.49321.14
5.6.190.0070.50321.11
5.6.180.0070.51321.16
5.6.170.0100.56021.08
5.6.160.0030.50021.17
5.6.150.0100.46720.99
5.6.140.0030.50021.02
5.6.130.0100.52721.13
5.6.120.0130.48021.07
5.6.110.0100.43321.14
5.6.100.0030.38321.05
5.6.90.0100.46721.13
5.6.80.0070.52020.37
5.6.70.0030.47720.43
5.6.60.0100.53020.36
5.6.50.0100.53720.59
5.6.40.0000.48020.28
5.6.30.0070.50020.47
5.6.20.0070.45320.46
5.6.10.0000.48020.55
5.6.00.0070.40020.39
5.5.380.0030.52320.38
5.5.370.0070.52720.57
5.5.360.0070.57020.40
5.5.350.0030.53020.43
5.5.340.0100.52320.80
5.5.330.0130.46720.96
5.5.320.0170.51020.65
5.5.310.0130.49720.91
5.5.300.0070.50320.93
5.5.290.0030.41320.68
5.5.280.0170.53320.86
5.5.270.0030.41320.96
5.5.260.0000.43020.67
5.5.250.0030.50320.58
5.5.240.0070.49720.14
5.5.230.0030.53720.25
5.5.220.0000.52720.27
5.5.210.0070.49720.19
5.5.200.0230.50320.20
5.5.190.0030.59020.28
5.5.180.0070.47320.29
5.5.160.0030.50320.18
5.5.150.0030.50720.27
5.5.140.0030.43720.30
5.5.130.0070.46720.22
5.5.120.0130.51720.03
5.5.110.0100.50320.11
5.5.100.0070.54320.02
5.5.90.0070.53020.13
5.5.80.0170.55720.20
5.5.70.0030.48720.06
5.5.60.0000.51720.11
5.5.50.0070.52320.11
5.5.40.0070.55020.08
5.5.30.0030.54319.99
5.5.20.0030.47020.09
5.5.10.0170.52720.07
5.5.00.0030.56720.10
5.4.450.0100.55019.36
5.4.440.0070.50319.53
5.4.430.0070.41319.33
5.4.420.0100.52719.55
5.4.410.0070.56019.23
5.4.400.0070.55318.88
5.4.390.0030.50019.13
5.4.380.0030.54719.04
5.4.370.0070.53318.84
5.4.360.0000.49019.14
5.4.350.0030.51319.12
5.4.340.0070.48318.87
5.4.320.0100.48719.04
5.4.310.0000.40019.04
5.4.300.0000.39719.04
5.4.290.0070.53319.16
5.4.280.0100.54318.93
5.4.270.0130.53019.08
5.4.260.0070.53719.12
5.4.250.0070.54718.84
5.4.240.0170.54318.84
5.4.230.0030.48019.05
5.4.220.0100.57019.13
5.4.210.0070.53319.11
5.4.200.0070.54719.03
5.4.190.0070.55718.93
5.4.180.0030.45719.17
5.4.170.0130.58319.01
5.4.160.0070.54019.14
5.4.150.0030.52318.83
5.4.140.0030.45716.45
5.4.130.0100.48016.43
5.4.120.0000.48316.43
5.4.110.0030.53716.59
5.4.100.0100.49716.56
5.4.90.0070.53016.39
5.4.80.0070.53316.43
5.4.70.0400.46716.43
5.4.60.0070.55716.38
5.4.50.0030.55716.50
5.4.40.0000.55716.45
5.4.30.0100.55316.53
5.4.20.0030.57316.37
5.4.10.0200.53016.48
5.4.00.0000.55015.94
5.3.290.0100.60014.75
5.3.280.0000.46314.70
5.3.270.0030.63314.64
5.3.260.0030.62714.57
5.3.250.0030.62314.57
5.3.240.0030.59714.56
5.3.230.0000.50714.60
5.3.220.0070.59714.59
5.3.210.0000.55714.61
5.3.200.0030.61714.54
5.3.190.0070.56314.72
5.3.180.0030.60014.66
5.3.170.0230.65314.59
5.3.160.0130.62714.61
5.3.150.0030.63014.69
5.3.140.0070.63314.61
5.3.130.0070.56014.55
5.3.120.0030.62014.51
5.3.110.0100.60314.53
5.3.100.0070.55714.04
5.3.90.0030.63013.95
5.3.80.0030.59714.00
5.3.70.0070.63013.98
5.3.60.0100.64014.18
5.3.50.0130.63014.00
5.3.40.0030.53013.89
5.3.30.0030.53314.09
5.3.20.0070.64013.75
5.3.10.0070.58313.72
5.3.00.0070.62313.79
5.2.170.0100.56011.29
5.2.160.0000.71011.04
5.2.150.0070.73711.18
5.2.140.0030.70011.29
5.2.130.0100.69011.05
5.2.120.0100.67311.15
5.2.110.0030.65711.14
5.2.100.0170.67711.24
5.2.90.0030.70311.16
5.2.80.0000.60311.12
5.2.70.0030.60311.15
5.2.60.0030.55311.11
5.2.50.0000.60010.97
5.2.40.0030.67311.09
5.2.30.0000.61011.05
5.2.20.0000.59010.91
5.2.10.0070.54011.03
5.2.00.0030.52010.89
5.1.60.0030.0209.92
5.1.50.0030.0239.87
5.1.40.0000.02310.08
5.1.30.0100.04310.38
5.1.20.0000.04010.42
5.1.10.0000.02710.19
5.1.00.0070.04010.19
5.0.50.0000.0378.44
5.0.40.0000.0238.45
5.0.30.0030.0678.34
5.0.20.0000.0508.30
5.0.10.0030.0338.29
5.0.00.0000.0678.26
4.4.90.0000.0207.51
4.4.80.0000.0237.51
4.4.70.0000.0237.51
4.4.60.0030.0137.51
4.4.50.0000.0137.51
4.4.40.0030.0207.51
4.4.30.0030.0337.51
4.4.20.0000.0137.51
4.4.10.0030.0207.51
4.4.00.0030.0377.51
4.3.110.0030.0307.51
4.3.100.0030.0307.51
4.3.90.0000.0377.51
4.3.80.0000.0407.51
4.3.70.0000.0237.51
4.3.60.0030.0177.51
4.3.50.0030.0277.51
4.3.40.0070.0507.51
4.3.30.0000.0277.51
4.3.20.0000.0507.51
4.3.10.0000.0377.51
4.3.00.0030.0377.51

preferences:
36.57 ms | 401 KiB | 5 Q