3v4l.org

run code in 300+ PHP versions simultaneously
<?php function benchmarkMemory(callable $function, $args=null) { declare(ticks=1); if(!class_exists('classWithNoName')) { class classWithNoName { public static $memory, $max; } function functionWithNoName() { classWithNoName::$memory = memory_get_usage() - classWithNoName::$memory; classWithNoName::$max = classWithNoName::$memory>classWithNoName::$max? classWithNoName::$memory: classWithNoName::$max; classWithNoName::$memory = memory_get_usage(); } classWithNoName::$memory = memory_get_usage(); classWithNoName::$max = 0; } if (function_exists('register_tick_function')): register_tick_function('functionWithNoName'); $result = is_array($args)? call_user_func_array($function, $args): call_user_func_array($function); unregister_tick_function('functionWithNoName'); endif; $memory = classWithNoName::$max; classWithNoName::$max = 0; return [ 'memory' => $memory ]; } var_dump(benchmarkMemory('str_repeat', ['test',1E4]));//40068 var_dump(benchmarkMemory('str_repeat', ['test',1E3]));//4040

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.00.0110.00715.05
7.3.120.0000.01615.06
7.3.110.0030.01315.05
7.3.100.0070.00715.07
7.3.90.0000.00914.64
7.3.80.0040.00814.99
7.3.70.0040.01514.80
7.3.60.0060.00614.67
7.3.50.0090.00014.98
7.3.40.0060.00314.66
7.3.30.0030.01014.52
7.3.20.0070.01016.75
7.3.10.0070.01416.64
7.3.00.0110.00316.75
7.2.250.0150.00415.29
7.2.240.0060.01315.00
7.2.230.0030.00815.39
7.2.220.0000.01315.41
7.2.210.0070.00714.76
7.2.200.0060.00614.97
7.2.190.0090.00315.19
7.2.180.0070.00715.12
7.2.170.0060.00315.21
7.1.330.0030.01016.08
7.1.320.0040.00715.60
7.1.310.0060.00915.96
7.1.300.0090.00415.83
7.1.290.0100.00315.72
7.1.280.0030.00815.81
7.1.270.0060.00615.80
7.1.260.0070.01015.45
7.1.70.0000.00717.29
7.1.60.0070.01719.32
7.1.50.0150.00316.70
7.1.00.0030.07722.34
7.0.200.0040.00416.93
7.0.140.0100.06722.21
7.0.60.0070.08019.87
7.0.50.0030.09017.96
7.0.40.0030.04320.04
7.0.30.0400.06320.27
7.0.20.0200.08720.08
7.0.10.0030.04720.26
7.0.00.0030.06020.20
5.6.280.0000.07721.01
5.6.210.0130.08020.67
5.6.200.0100.07318.28
5.6.190.0070.04320.79
5.6.180.0300.05720.61
5.6.170.0300.05020.44
5.6.160.0070.06020.48
5.6.150.0030.08018.21
5.6.140.0100.07318.15
5.6.130.0070.08018.21
5.6.120.0070.08320.77
5.6.110.0030.07321.00
5.6.100.0100.06721.01
5.6.90.0000.07721.01
5.6.80.0100.07320.55
5.5.350.0100.07720.50
5.5.340.0030.04018.05
5.5.330.0100.05720.57
5.5.320.0300.06020.28
5.5.310.0300.07020.27
5.5.300.0070.07017.96
5.5.290.0100.06018.01
5.5.280.0130.06320.74
5.5.270.0070.09020.86
5.5.260.0070.06020.98
5.5.250.0030.08720.60
5.5.240.0230.07320.30
5.4.450.0870.05019.48
5.4.440.0770.06319.62
5.4.430.1030.05719.62
5.4.420.0630.00019.63
5.4.410.0630.00019.31
5.4.400.0630.00018.92
5.4.390.0630.00019.27
5.4.380.0730.00019.24
5.4.370.0630.00019.26
5.4.360.0600.00019.16
5.4.350.0630.00019.19
5.4.340.0070.03812.03
5.4.320.0050.03912.52
5.4.310.0050.04012.51
5.4.300.0080.04012.52
5.4.290.0080.04512.51
5.4.280.0080.04812.41
5.4.270.0070.04312.41
5.4.260.0070.03912.41
5.4.250.0070.03912.41
5.4.240.0040.04412.41
5.4.230.0070.04312.40
5.4.220.0030.04212.40
5.4.210.0060.03812.40
5.4.200.0100.03912.40
5.4.190.0080.03912.39
5.4.180.0050.04312.40
5.4.170.0060.03712.41
5.4.160.0050.03812.39
5.4.150.0070.03612.39
5.4.140.0110.03512.07
5.4.130.0040.03712.07
5.4.120.0070.03712.03
5.4.110.0020.04112.02
5.4.100.0090.03312.02
5.4.90.0060.04312.02
5.4.80.0060.03912.02
5.4.70.0060.03512.02
5.4.60.0070.03812.02
5.4.50.0070.03712.02
5.4.40.0050.04212.01
5.4.30.0020.04212.00
5.4.20.0080.03912.00
5.4.10.0070.04012.00
5.4.00.0130.05611.50
5.3.290.0090.04312.80
5.3.280.0050.05012.71
5.3.270.0080.04112.72
5.3.260.0080.03912.72
5.3.250.0060.03812.72
5.3.240.0080.03512.72
5.3.230.0060.04112.71
5.3.220.0060.03712.68
5.3.210.0040.04712.68
5.3.200.0080.04212.68
5.3.190.0040.04512.68
5.3.180.0050.03812.67
5.3.170.0100.04112.66
5.3.160.0040.03912.68
5.3.150.0080.03912.67
5.3.140.0070.03512.66
5.3.130.0140.04612.66
5.3.120.0100.04912.66
5.3.110.0070.04212.66
5.3.100.0030.04212.13
5.3.90.0040.04012.12
5.3.80.0070.03612.11
5.3.70.0100.04112.10
5.3.60.0030.03912.09
5.3.50.0080.03912.03
5.3.40.0060.04212.04
5.3.30.0100.03612.00
5.3.20.0040.03711.78
5.3.10.0070.04311.75
5.3.00.0060.04211.73
5.2.170.0030.0369.22
5.2.160.0060.0309.23
5.2.150.0050.0339.23
5.2.140.0100.0329.22
5.2.130.0040.0319.19
5.2.120.0030.0319.18
5.2.110.0030.0319.19
5.2.100.0030.0329.19
5.2.90.0050.0309.19
5.2.80.0050.0309.18
5.2.70.0050.0309.19
5.2.60.0040.0319.14
5.2.50.0060.0389.12
5.2.40.0060.0349.09
5.2.30.0030.0369.06
5.2.20.0050.0289.05
5.2.10.0040.0298.96
5.2.00.0060.0288.82
5.1.60.0050.0238.11
5.1.50.0060.0238.11
5.1.40.0060.0238.08
5.1.30.0050.0268.43
5.1.20.0010.0298.45
5.1.10.0030.0288.18
5.1.00.0040.0268.18
5.0.50.0040.0216.66
5.0.40.0050.0186.52
5.0.30.0020.0356.33
5.0.20.0070.0176.30
5.0.10.0060.0256.28
5.0.00.0030.0366.27
4.4.90.0020.0194.78
4.4.80.0060.0124.76
4.4.70.0040.0154.75
4.4.60.0040.0164.75
4.4.50.0050.0194.77
4.4.40.0020.0274.71
4.4.30.0040.0154.76
4.4.20.0030.0224.84
4.4.10.0030.0154.84
4.4.00.0090.0314.76
4.3.110.0020.0194.67
4.3.100.0030.0164.67
4.3.90.0030.0174.63
4.3.80.0040.0234.58
4.3.70.0040.0254.63
4.3.60.0030.0184.63
4.3.50.0010.0214.63
4.3.40.0020.0244.54
4.3.30.0030.0193.30
4.3.20.0020.0153.28
4.3.10.0030.0163.23
4.3.00.0170.0207.34

preferences:
32.27 ms | 401 KiB | 5 Q