3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compareA($a, $b) { return strcmp(json_encode($a), json_encode($b)); } function compareB($a, $b) { return strcmp(implode(',', $a), implode(',', $b)); } function array_diff_multi($a, $b) { return array_map('json_decode', array_diff(array_map('json_encode', $a), array_map('json_encode', $b))); } function bench_diff($a, $b, $callback) { for ($i = 0; $i < 1000; $i++) { $c = array_udiff($a, $b, $callback); } $start = microtime(true); for ($i = 0; $i < 1000; $i++) { $c = array_udiff($a, $b, $callback); } $end = microtime(true); echo $callback, "\t", ($end - $start) * 1000, ' ms', PHP_EOL; return $c; } $a = array( array('localhost', 11211, 0), array('localhost', 11211, 0), array('localhost', 11212, 0), array('localhost', 11213, 0), array('localhost', 11214, 0), array('localhost', 11214, 0), array('localhost', 11214, 0), array('localhost', 11212, 0), array('other', 11211, 0), array('localhost', 11211, 0), ); $b = array( array('localhost', 11211, 0), array('other', 11211, 0), array('other', 11212, 0), array('localhost', 11212, 0), array('localhost', 11212, 0), array('localhost', 11213, 0), ); $c = bench_diff($a, $b, 'compareA'); $c = bench_diff($a, $b, 'compareB'); for ($i = 0; $i < 1000; $i++) { $c = array_diff_multi($a, $b); } $start = microtime(true); for ($i = 0; $i < 1000; $i++) { $c = array_diff_multi($a, $b); } $end = microtime(true); echo "diff-json\t", ($end - $start) * 1000, ' ms', PHP_EOL; var_export($c);

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.60.0110.08116.26
7.4.50.0130.07816.20
7.4.40.0130.08816.26
7.4.30.0220.12916.03
7.4.20.0100.10516.21
7.4.10.0100.08516.22
7.4.00.0100.14016.52
7.3.180.0030.08316.70
7.3.170.0100.08016.53
7.3.160.0160.10116.26
7.3.150.0090.14816.18
7.3.140.0130.09416.24
7.3.130.0060.08616.48
7.3.120.0070.08516.48
7.3.110.0160.12616.39
7.3.100.0200.07316.36
7.3.90.0160.07416.21
7.3.80.0130.09516.20
7.3.70.0130.13816.30
7.3.60.0100.08916.25
7.3.50.0070.08816.33
7.3.40.0130.09716.19
7.3.30.0130.07816.37
7.3.20.0230.07816.34
7.3.10.0150.07316.38
7.3.00.0130.07916.30
7.2.310.0140.07916.34
7.2.300.0070.15216.44
7.2.290.0170.11416.70
7.2.280.0070.11716.29
7.2.270.0060.13616.30
7.2.260.0100.15416.61
7.2.250.0130.16416.55
7.2.240.0160.07916.50
7.2.230.0070.08716.26
7.2.220.0130.08216.41
7.2.210.0100.08516.28
7.2.200.0070.16216.04
7.2.190.0180.14716.52
7.2.180.0030.09416.64
7.2.170.0130.08616.23
7.2.160.0060.10216.39
7.2.150.0070.08716.69
7.2.140.0100.08516.53
7.2.130.0070.08716.48
7.2.120.0160.07616.64
7.2.110.0110.07916.54
7.2.100.0180.07416.46
7.2.90.0210.08416.50
7.2.80.0140.08116.63
7.2.70.0250.07816.78
7.2.60.0150.08016.73
7.2.50.0150.07416.62
7.2.40.0180.08016.74
7.2.30.0210.08016.68
7.2.20.0160.09816.66
7.2.10.0100.08716.63
7.2.00.0230.07116.51
7.1.330.0320.17515.43
7.1.320.0160.18415.38
7.1.310.0160.18615.55
7.1.300.0090.11115.61
7.1.290.0130.10615.45
7.1.280.0060.14315.36
7.1.270.0160.16915.56
7.1.260.0130.10615.27
7.1.250.0100.11115.52
7.1.240.0070.11015.36
7.1.230.0030.09415.51
7.1.220.0120.09415.71
7.1.210.0130.09815.38
7.1.200.0100.09615.63
7.1.190.0210.09815.67
7.1.180.0130.09215.46
7.1.170.0120.11215.56
7.1.160.0140.09615.55
7.1.150.0110.10115.53
7.1.140.0170.09815.64
7.1.130.0150.09015.65
7.1.120.0140.09715.53
7.1.110.0080.10215.75
7.1.100.0110.10415.64
7.1.90.0130.10515.48
7.1.80.0120.10815.70
7.1.70.0150.08916.17
7.1.60.0160.10416.95
7.1.50.0120.09716.18
7.1.40.0090.12115.65
7.1.30.0810.10015.73
7.1.20.0160.09615.73
7.1.10.0100.10915.65
7.1.00.0050.12317.85
7.0.330.0190.10015.15
7.0.320.0070.12114.88
7.0.310.0110.09715.17
7.0.300.0170.09715.30
7.0.290.0160.09915.28
7.0.280.0180.10015.22
7.0.270.0160.10115.11
7.0.260.0130.10115.26
7.0.250.0090.09915.25
7.0.240.0100.10215.33
7.0.230.0150.09215.24
7.0.220.0080.10115.26
7.0.210.0130.09315.48
7.0.200.0120.10115.15
7.0.190.0160.09615.29
7.0.180.0180.10215.31
7.0.170.0070.10915.36
7.0.160.0160.09515.37
7.0.150.0140.10115.31
7.0.140.0150.12317.47
7.0.130.0250.10415.36
7.0.120.0150.09915.38
7.0.110.0210.08615.28
7.0.100.0140.10415.05
7.0.90.0280.11016.87
7.0.80.0230.10216.83
7.0.70.0280.10216.84
7.0.60.0330.12117.02
7.0.50.0270.12417.15
7.0.40.0120.13616.48
7.0.30.0100.12316.46
7.0.20.0060.12716.42
7.0.10.0300.10216.33
7.0.00.0130.11516.61
5.6.400.0100.29515.95
5.6.390.0130.29415.86
5.6.380.0100.24815.19
5.6.370.0110.25815.24
5.6.360.0140.26615.26
5.6.350.0120.35115.11
5.6.340.0150.25415.18
5.6.330.0140.25215.05
5.6.320.0070.26815.07
5.6.310.0120.28214.77
5.6.300.0160.26114.95
5.6.290.0170.25914.83
5.6.280.0120.27516.96
5.6.270.0130.27715.28
5.6.260.0080.26115.04
5.6.250.0080.26815.13
5.6.240.0090.28916.90
5.6.230.0100.24116.93
5.6.220.0120.24516.95
5.6.210.0130.24916.81
5.6.200.0100.25317.08
5.6.190.0090.25316.94
5.6.180.0110.25517.05
5.6.170.0080.25817.06
5.6.160.0140.24617.12
5.6.150.0150.24516.97
5.6.140.0190.27217.03
5.6.130.0280.26116.97
5.6.120.0150.28316.96
5.6.110.0160.24417.11
5.6.100.0060.25417.12
5.6.90.0130.25217.08
5.6.80.0090.27316.85
5.6.70.0070.25716.72
5.6.60.0030.23316.88
5.6.50.0110.25416.79
5.6.40.0110.24716.81
5.6.30.0100.24116.76
5.6.20.0110.25816.87
5.6.10.0090.25916.86
5.6.00.0100.25416.71
5.5.380.0140.25116.37
5.5.370.0120.25316.29
5.5.360.0100.26016.28
5.5.350.0100.25216.32
5.5.340.0100.23716.50
5.5.330.0110.24416.45
5.5.320.0110.26016.48
5.5.310.0070.25616.47
5.5.300.0090.26416.53
5.5.290.0120.25216.39
5.5.280.0090.29316.45
5.5.270.0120.25916.45
5.5.260.0070.25616.44
5.5.250.0040.26616.31
5.5.240.0110.26816.22
5.5.230.0110.24416.18
5.5.220.0100.25716.30
5.5.210.0100.24116.18
5.5.200.0140.26316.21
5.5.190.0070.25016.31
5.5.180.0040.26316.30
5.5.170.0060.27014.73
5.5.160.0050.23916.18
5.5.150.0090.22516.22
5.5.140.0080.25416.17
5.5.130.0220.24616.17
5.5.120.0080.26716.19
5.5.110.0080.27216.19
5.5.100.0090.27016.16
5.5.90.0120.24016.22
5.5.80.0120.26216.18
5.5.70.0130.25516.11
5.5.60.0120.25016.15
5.5.50.0120.25416.12
5.5.40.0060.23716.15
5.5.30.0140.24616.16
5.5.20.0070.25216.13
5.5.10.0100.26816.13
5.5.00.0090.25616.22
5.4.450.0100.25814.97
5.4.440.0100.26714.94
5.4.430.0110.26714.89
5.4.420.0090.24014.81
5.4.410.0110.27214.88
5.4.400.0040.26614.79
5.4.390.0080.24414.76
5.4.380.0080.23614.86
5.4.370.0100.24614.92
5.4.360.0080.27014.82
5.4.350.0070.24714.83
5.4.340.0050.24314.75
5.4.330.0100.25912.61
5.4.320.0100.22414.85
5.4.310.0030.23914.66
5.4.300.0090.26014.85
5.4.290.0090.25414.84
5.4.280.0100.26214.77
5.4.270.0100.24814.82
5.4.260.0030.24914.75
5.4.250.0090.24114.69
5.4.240.0120.25214.77
5.4.230.0150.25014.78
5.4.220.0140.24614.78
5.4.210.0050.25114.71
5.4.200.0120.23314.85
5.4.190.0060.24414.80
5.4.180.0080.25214.77
5.4.170.0150.25414.80
5.4.160.0090.29014.80
5.4.150.0070.28414.86
5.4.140.0040.27113.94
5.4.130.0150.26413.90
5.4.120.0080.26513.95
5.4.110.0100.24413.83
5.4.100.0130.29313.92
5.4.90.0100.28613.95
5.4.80.0150.26613.93
5.4.70.0110.26913.94
5.4.60.0060.24713.91
5.4.50.0090.25813.86
5.4.40.0090.25513.88
5.4.30.0110.25913.85
5.4.20.0130.25213.92
5.4.10.0070.27914.00
5.4.00.0110.27913.73
5.3.290.0090.22713.54
5.3.280.0060.26913.51
5.3.270.0110.26813.54
5.3.260.0080.27313.51
5.3.250.0100.29513.54
5.3.240.0120.31313.50
5.3.230.0100.26813.47
5.3.220.0090.27213.47
5.3.210.0100.27313.43
5.3.200.0060.26013.39
5.3.190.0080.27813.50
5.3.180.0170.26913.45
5.3.170.0140.26813.60
5.3.160.0050.27713.50
5.3.150.0080.25713.45
5.3.140.0100.29213.56
5.3.130.0130.36413.45
5.3.120.0100.28413.48
5.3.110.0030.28313.52
5.3.100.0090.25713.37
5.3.90.0050.26513.41
5.3.80.0050.25713.27
5.3.70.0010.27813.26
5.3.60.0040.25013.27
5.3.50.0080.27813.24
5.3.40.0100.30113.33
5.3.30.0070.27713.30
5.3.20.0090.27513.21
5.3.10.0100.27313.18
5.3.00.0100.27413.16
5.2.170.0010.23512.09
5.2.160.0030.25512.00
5.2.150.0050.24012.10
5.2.140.0080.27312.02
5.2.130.0070.25712.01
5.2.120.0080.24312.05
5.2.110.0070.24011.96
5.2.100.0040.26711.98
5.2.90.0060.25412.09
5.2.80.0090.26011.95
5.2.70.0060.24912.04
5.2.60.0060.27811.89
5.2.50.0130.24211.96
5.2.40.0130.25111.89
5.2.30.0050.25611.97
5.2.20.0100.26811.96
5.2.10.0070.28911.79
5.2.00.0080.29211.77
5.1.60.0060.01111.31
5.1.50.0010.01911.23
5.1.40.0020.02411.33
5.1.30.0050.02211.48
5.1.20.0000.02111.48
5.1.10.0040.02011.40
5.1.00.0040.01411.31
5.0.50.0040.01510.59
5.0.40.0050.01010.42
5.0.30.0020.02310.40
5.0.20.0060.01610.34
5.0.10.0070.01910.40
5.0.00.0080.02110.33
4.4.90.0040.01310.00
4.4.80.0010.01910.00
4.4.70.0030.01210.00
4.4.60.0030.01610.00
4.4.50.0040.01210.00
4.4.40.0050.02010.00
4.4.30.0010.01010.00
4.4.20.0020.00810.00
4.4.10.0050.01110.00
4.4.00.0040.02010.00
4.3.110.0040.01310.00
4.3.100.0030.01010.00
4.3.90.0060.01110.00
4.3.80.0030.02010.00
4.3.70.0020.01510.00
4.3.60.0020.01310.00
4.3.50.0020.01410.00
4.3.40.0020.01910.00
4.3.30.0010.01510.00
4.3.20.0010.01110.00
4.3.10.0010.01510.00
4.3.00.0030.00810.00

preferences:
29.9 ms | 401 KiB | 5 Q