3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Object hashing tests. */ $sos = new SplObjectStorage(); $docs = array(); $iterations = 100; for ($i = 0; $i < $iterations; ++$i) { $doc = new DOMDocument(); //$doc = new stdClass(); $docs[] = $doc; } $start = $finis = 0; $mem_empty = memory_get_usage(); // Load the SplObjectStorage $start = microtime(TRUE); foreach ($docs as $d) { $sos->attach($d); } $finis = microtime(TRUE); $time_to_fill = $finis - $start; // Check membership on the object storage $start = microtime(FALSE); foreach ($docs as $d) { $sos->contains($d); } $finis = microtime(FALSE); $time_to_check = $finis - $start; $mem_spl = memory_get_usage(); $mem_used = $mem_spl - $mem_empty; printf("SplObjectStorage:\nTime to fill: %0.12f.\nTime to check: %0.12f.\nMemory: %d\n\n", $time_to_fill, $time_to_check, $mem_used); unset($sos); $mem_empty = memory_get_usage(); // Test arrays: $start = microtime(TRUE); $arr = array(); // Load the array foreach ($docs as $d) { $arr[spl_object_hash($d)] = $d; } $finis = microtime(TRUE); $time_to_fill = $finis - $start; // Check membership on the array $start = microtime(FALSE); foreach ($docs as $d) { //$arr[spl_object_hash($d)]; isset($arr[spl_object_hash($d)]); } $finis = microtime(FALSE); $time_to_check = $finis - $start; $mem_arr = memory_get_usage(); $mem_used = $mem_arr - $mem_empty; printf("Arrays:\nTime to fill: %0.12f.\nTime to check: %0.12f.\nMemory: %d\n\n", $time_to_fill, $time_to_check, $mem_used);

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.4.10.0090.00914.88
7.4.00.0000.01215.12
7.3.130.0100.00715.01
7.3.120.0030.01315.07
7.3.110.0120.00615.19
7.3.100.0100.00314.97
7.3.90.0030.01014.92
7.3.80.0100.00315.14
7.3.70.0090.00415.12
7.3.60.0060.00914.98
7.3.50.0040.00414.56
7.3.40.0000.00814.80
7.3.30.0040.00415.02
7.3.20.0040.00716.82
7.3.10.0030.00816.79
7.3.00.0120.00316.78
7.2.260.0030.01715.30
7.2.250.0070.01015.07
7.2.240.0100.00715.26
7.2.230.0030.01115.09
7.2.220.0030.01415.21
7.2.210.0070.00715.04
7.2.200.0070.01015.17
7.2.190.0060.00615.28
7.2.180.0070.01014.91
7.2.170.0070.01014.97
7.2.160.0070.01014.86
7.2.150.0060.00917.05
7.2.140.0060.00816.96
7.2.130.0070.00716.90
7.2.120.0090.00517.03
7.2.110.0030.01016.88
7.2.100.0090.00516.97
7.2.90.0050.01317.02
7.2.80.0060.01016.96
7.2.70.0060.00916.89
7.2.60.0060.00817.01
7.2.50.0050.01016.82
7.2.40.0050.01117.01
7.2.30.0030.00816.94
7.2.20.0050.00916.90
7.2.10.0100.00417.02
7.2.00.0030.01216.99
7.1.330.0030.00815.55
7.1.320.0000.01115.91
7.1.310.0030.01015.85
7.1.300.0030.01015.97
7.1.290.0040.00415.87
7.1.280.0090.00315.99
7.1.270.0100.00315.70
7.1.260.0060.01015.91
7.1.250.0080.00915.77
7.1.240.0030.01015.61
7.1.230.0030.01415.86
7.1.220.0100.00315.71
7.1.210.0060.00615.85
7.1.200.0040.01215.96
7.1.190.0100.00716.02
7.1.180.0080.00615.89
7.1.170.0100.00716.00
7.1.160.0070.01015.96
7.1.150.0030.00916.01
7.1.140.0030.01415.95
7.1.130.0100.00715.59
7.1.120.0100.00015.95
7.1.110.0030.01115.84
7.1.100.0070.01115.80
7.1.90.0030.01415.74
7.1.80.0100.00315.87
7.1.70.0060.00616.45
7.1.60.0080.01317.64
7.1.50.0060.01316.40
7.1.40.0100.00315.79
7.1.30.0120.00315.93
7.1.20.0030.01215.56
7.1.10.0080.00316.03
7.1.00.0030.04019.22
7.0.330.0040.00715.46
7.0.320.0030.00915.62
7.0.310.0070.00715.30
7.0.300.0100.00615.50
7.0.290.0000.01515.34
7.0.280.0100.00315.54
7.0.270.0000.01015.45
7.0.260.0040.00815.46
7.0.250.0090.00315.53
7.0.240.0070.01115.62
7.0.230.0030.01015.47
7.0.220.0060.00615.30
7.0.210.0000.01215.54
7.0.200.0050.00715.81
7.0.190.0030.01015.43
7.0.180.0040.00715.25
7.0.170.0110.00415.33
7.0.160.0070.00715.50
7.0.150.0070.00715.58
7.0.140.0060.04118.63
7.0.130.0120.00315.21
7.0.120.0130.00015.47
7.0.110.0070.00715.53
7.0.100.0030.02817.72
7.0.90.0050.03717.66
7.0.80.0150.04717.79
7.0.70.0080.04217.66
7.0.60.0250.03317.70
7.0.50.0120.03817.95
7.0.40.0060.04416.72
7.0.30.0150.03116.90
7.0.20.0070.02716.68
7.0.10.0100.02816.83
7.0.00.0070.03716.88
5.6.400.0000.01714.54
5.6.390.0040.01114.78
5.6.380.0090.00314.32
5.6.370.0040.01414.53
5.6.360.0090.00314.84
5.6.350.0060.00914.69
5.6.340.0040.01114.53
5.6.330.0090.00314.62
5.6.320.0080.00814.84
5.6.310.0040.01114.57
5.6.300.0130.00014.32
5.6.290.0060.01214.55
5.6.280.0040.04317.74
5.6.270.0090.00914.46
5.6.260.0060.01214.64
5.6.250.0120.03517.50
5.6.240.0070.04417.53
5.6.230.0080.03717.64
5.6.220.0110.03817.55
5.6.210.0120.04317.63
5.6.200.0070.04317.75
5.6.190.0120.04517.80
5.6.180.0050.05017.78
5.6.170.0090.04117.68
5.6.160.0080.04517.77
5.6.150.0070.04417.76
5.6.140.0100.04117.98
5.6.130.0050.02917.79
5.6.120.0090.03217.82
5.6.110.0090.04017.85
5.6.100.0090.03217.84
5.6.90.0160.03417.71
5.6.80.0080.04017.29
5.6.70.0060.03817.31
5.6.60.0080.03317.41
5.6.50.0060.04317.44
5.6.40.0070.03817.48
5.6.30.0050.03317.45
5.6.20.0070.04217.44
5.6.10.0130.03017.43
5.6.00.0030.04617.42
5.5.380.0070.04517.58
5.5.370.0080.04117.54
5.5.360.0100.04517.54
5.5.350.0070.04017.61
5.5.340.0030.04717.65
5.5.330.0050.04017.80
5.5.320.0050.03017.75
5.5.310.0070.04217.77
5.5.300.0080.04417.79
5.5.290.0030.04617.82
5.5.280.0080.04417.77
5.5.270.0050.02617.63
5.5.260.0050.02817.67
5.5.250.0050.03217.61
5.5.240.0070.04517.36
5.5.230.0020.03317.32
5.5.220.0110.03817.27
5.5.210.0090.02817.45
5.5.200.0080.03817.36
5.5.190.0080.04317.41
5.5.180.0050.04617.53
5.5.170.0050.00514.49
5.5.160.0070.04017.42
5.5.150.0060.02317.38
5.5.140.0070.04517.40
5.5.130.0050.04317.32
5.5.120.0060.04017.48
5.5.110.0030.03217.46
5.5.100.0080.04517.30
5.5.90.0100.03017.46
5.5.80.0030.04517.31
5.5.70.0030.03117.29
5.5.60.0070.04717.31
5.5.50.0050.04217.26
5.5.40.0070.02617.34
5.5.30.0090.03917.22
5.5.20.0050.04017.17
5.5.10.0100.03817.30
5.5.00.0080.02817.02
5.4.450.0020.04915.29
5.4.440.0050.04315.29
5.4.430.0080.04015.27
5.4.420.0070.04115.17
5.4.410.0050.04215.28
5.4.400.0070.02315.08
5.4.390.0070.04015.10
5.4.380.0030.04315.00
5.4.370.0040.04114.96
5.4.360.0050.04214.96
5.4.350.0080.04215.09
5.4.340.0050.04315.04
5.4.330.0030.00911.05
5.4.320.0090.02915.03
5.4.310.0030.04415.09
5.4.300.0090.03114.92
5.4.290.0100.02114.90
5.4.280.0050.03815.02
5.4.270.0070.03315.03
5.4.260.0030.04415.10
5.4.250.0100.03715.20
5.4.240.0050.02314.98
5.4.230.0080.03715.17
5.4.220.0050.04715.03
5.4.210.0030.04015.18
5.4.200.0070.04315.09
5.4.190.0070.02615.17
5.4.180.0050.04015.06
5.4.170.0030.03815.01
5.4.160.0090.02815.04
5.4.150.0080.04015.02
5.4.140.0050.03813.76
5.4.130.0030.02513.81
5.4.120.0070.02813.91
5.4.110.0020.04213.83
5.4.100.0030.03413.81
5.4.90.0030.03513.73
5.4.80.0070.03213.64
5.4.70.0030.04813.80
5.4.60.0130.03013.77
5.4.50.0030.04213.62
5.4.40.0080.03713.71
5.4.30.0090.03513.82
5.4.20.0110.01713.79
5.4.10.0000.02713.80
5.4.00.0050.02213.33
5.3.290.0020.02812.71
5.3.280.0050.02512.64
5.3.270.0020.04212.74
5.3.260.0060.02612.68
5.3.250.0070.03812.62
5.3.240.0050.03712.61
5.3.230.0080.03812.58
5.3.220.0070.03312.39
5.3.210.0020.03812.56
5.3.200.0070.03712.55
5.3.190.0090.02012.53
5.3.180.0080.03512.67
5.3.170.0080.04112.67
5.3.160.0080.04012.64
5.3.150.0070.03312.67
5.3.140.0100.03212.57
5.3.130.0050.02712.69
5.3.120.0060.02612.64
5.3.110.0030.02412.68
5.3.100.0030.02312.26
5.3.90.0030.02512.15
5.3.80.0030.02512.28
5.3.70.0020.02412.29
5.3.60.0080.01512.21
5.3.50.0030.02012.30
5.3.40.0020.02112.27
5.3.30.0030.02112.29
5.3.20.0060.02112.15
5.3.10.0030.01812.07
5.3.00.0020.02312.08
5.2.170.0070.03011.24
5.2.160.0030.02711.21
5.2.150.0130.02011.15
5.2.140.0030.02711.25
5.2.130.0100.02011.05
5.2.120.0100.02011.23
5.2.110.0070.02711.23
5.2.100.0030.03011.14
5.2.90.0000.02710.98
5.2.80.0000.03310.99
5.2.70.0000.04011.22
5.2.60.0000.02711.14
5.2.50.0030.02710.96
5.2.40.0000.03711.09
5.2.30.0100.03011.08
5.2.20.0000.03011.10
5.2.10.0000.03010.98
5.2.00.0030.02710.71
5.1.60.0030.02710.17
5.1.50.0030.02310.08
5.1.40.0000.02710.05
5.1.30.0000.02710.46
5.1.20.0030.02310.48
5.1.10.0030.02010.20
5.1.00.0030.02710.14
5.0.50.0000.0178.58
5.0.40.0000.0238.44
5.0.30.0030.0308.23
5.0.20.0000.0208.13
5.0.10.0000.0208.31
5.0.00.0000.0308.26
4.4.90.0030.0138.13
4.4.80.0000.0138.13
4.4.70.0000.0178.13
4.4.60.0030.0138.13
4.4.50.0000.0138.13
4.4.40.0000.0238.13
4.4.30.0000.0178.13
4.4.20.0000.0178.13
4.4.10.0030.0138.13
4.4.00.0000.0238.13
4.3.110.0030.0138.13
4.3.100.0030.0138.13
4.3.90.0000.0178.13
4.3.80.0000.0208.13
4.3.70.0000.0138.13
4.3.60.0000.0138.13
4.3.50.0030.0108.13
4.3.40.0100.0138.13
4.3.30.0000.0178.13
4.3.20.0000.0138.13
4.3.10.0000.0178.13
4.3.00.0000.0138.13

preferences:
37.66 ms | 401 KiB | 5 Q