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; } register_tick_function('functionWithNoName'); $result = is_array($args)? call_user_func_array($function, $args): call_user_func_array($function); unregister_tick_function('functionWithNoName'); $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.0000.01514.88
7.3.120.0080.00915.14
7.3.110.0070.01115.00
7.3.100.0080.00815.12
7.3.90.0030.01214.87
7.3.80.0130.00315.01
7.3.70.0030.01014.90
7.3.60.0070.00414.68
7.3.50.0070.00414.77
7.3.40.0040.00814.90
7.3.30.0060.00614.82
7.3.20.0040.01116.49
7.3.10.0090.00316.76
7.3.00.0070.00516.69
7.2.250.0000.01815.35
7.2.240.0100.01015.29
7.2.230.0100.01014.97
7.2.220.0060.00614.74
7.2.210.0060.00614.98
7.2.200.0120.00414.82
7.2.190.0160.00015.07
7.2.180.0000.01415.18
7.2.170.0040.00815.17
7.2.130.0130.00716.92
7.2.120.0070.01316.85
7.2.110.0150.00216.91
7.2.100.0080.00816.98
7.2.90.0090.00116.85
7.2.80.0040.00916.90
7.2.70.0060.00716.98
7.2.60.0090.00717.02
7.2.50.0050.00716.84
7.2.40.0050.00716.98
7.2.30.0080.00617.02
7.2.20.0050.00916.87
7.2.10.0030.00816.78
7.2.00.0070.00717.77
7.1.330.0030.01415.98
7.1.320.0030.00615.96
7.1.310.0060.00616.05
7.1.300.0030.01015.85
7.1.290.0100.00315.70
7.1.280.0000.01215.44
7.1.270.0070.00715.86
7.1.260.0070.01015.75
7.1.250.0090.00615.88
7.1.240.0070.00915.82
7.1.230.0070.01215.86
7.1.220.0050.00915.75
7.1.210.0070.00615.80
7.1.200.0080.00315.87
7.1.190.0080.00215.79
7.1.180.0040.00715.81
7.1.170.0100.00415.67
7.1.160.0060.00615.77
7.1.150.0000.01315.77
7.1.140.0020.00915.73
7.1.130.0020.01115.90
7.1.120.0030.01015.81
7.1.110.0050.00815.84
7.1.100.0060.00915.66
7.1.90.0050.00715.72
7.1.80.0090.00615.78
7.1.70.0060.00516.28
7.1.60.0060.01016.89
7.1.50.0070.00816.15
7.1.40.0070.00715.81
7.1.30.0050.01015.73
7.1.20.0000.00915.62
7.1.10.0100.00315.82
7.1.00.0040.02818.02
7.0.330.0020.00815.26
7.0.320.0060.00615.41
7.0.310.0030.00715.56
7.0.300.0020.00715.40
7.0.290.0060.00515.27
7.0.280.0030.00715.23
7.0.270.0080.00515.27
7.0.260.0040.00515.17
7.0.250.0060.01015.42
7.0.240.0070.00715.32
7.0.230.0120.00415.56
7.0.220.0060.00815.37
7.0.210.0100.00315.24
7.0.200.0020.00615.81
7.0.190.0060.00515.37
7.0.180.0030.00815.40
7.0.170.0110.00515.38
7.0.160.0050.00715.34
7.0.150.0070.00815.28
7.0.140.0050.03217.67
7.0.130.0070.00715.43
7.0.120.0060.00715.36
7.0.110.0080.00515.44
7.0.100.0070.01916.96
7.0.90.0090.02716.90
7.0.80.0100.03116.85
7.0.70.0070.03317.03
7.0.60.0080.02416.86
7.0.50.0030.03017.19
7.0.40.0070.01715.65
7.0.30.0040.01915.71
7.0.20.0080.01915.68
7.0.10.0050.02715.56
7.0.00.0050.02315.69
5.6.380.0080.00614.12
5.6.370.0060.00814.17
5.6.360.0050.00814.38
5.6.350.0090.00614.29
5.6.340.0060.00814.31
5.6.330.0070.00714.28
5.6.320.0050.00614.19
5.6.310.0030.01014.30
5.6.300.0070.00414.53
5.6.290.0050.00714.22
5.6.280.0060.00714.44
5.6.270.0080.00714.40
5.6.260.0010.01114.31
5.6.250.0060.02216.57
5.6.240.0090.02916.36
5.6.230.0070.02216.50
5.6.220.0080.02516.45
5.6.210.0080.02916.31
5.6.200.0080.03116.61
5.6.190.0040.02616.75
5.6.180.0040.02116.64
5.6.170.0060.02716.81
5.6.160.0050.02216.53
5.6.150.0060.01916.69
5.6.140.0040.02316.46
5.6.130.0040.03216.48
5.6.120.0050.03216.73
5.6.110.0090.01816.55
5.6.100.0110.02516.54
5.6.90.0100.02616.67
5.6.80.0100.02916.28
5.6.70.0060.02916.22
5.6.60.0050.02016.29
5.6.50.0110.02816.38
5.6.40.0030.02316.44
5.6.30.0040.02416.34
5.6.20.0070.02716.40
5.6.10.0070.02516.38
5.6.00.0010.02416.29
5.5.380.0050.02914.53
5.5.370.0050.01614.54
5.5.360.0080.03114.58
5.5.350.0080.03014.57
5.5.340.0040.03314.68
5.5.330.0020.02914.67
5.5.320.0050.02214.66
5.5.310.0090.02814.67
5.5.300.0040.02214.70
5.5.290.0050.03414.67
5.5.280.0050.03114.63
5.5.270.0090.03114.72
5.5.260.0050.01914.68
5.5.250.0050.02914.62
5.5.240.0060.02714.52
5.5.230.0080.02714.46
5.5.220.0060.01614.52
5.5.210.0050.02914.51
5.5.200.0080.02014.49
5.5.190.0100.01314.49
5.5.180.0050.01914.49
5.5.170.0050.00511.62
5.5.160.0040.03114.50
5.5.150.0080.01714.50
5.5.140.0020.02214.49
5.5.130.0080.02314.47
5.5.120.0060.02414.46
5.5.110.0070.02614.46
5.5.100.0060.02214.47
5.5.90.0060.01814.44
5.5.80.0030.01714.39
5.5.70.0060.02914.44
5.5.60.0060.02814.43
5.5.50.0050.01914.43
5.5.40.0050.03214.46
5.5.30.0040.02114.44
5.5.20.0060.02514.41
5.5.10.0070.02714.41
5.5.00.0040.02814.43
5.4.450.0100.02414.26
5.4.440.0050.02514.14
5.4.430.0020.02614.23
5.4.420.0090.02814.15
5.4.410.0040.03214.17
5.4.400.0030.01714.03
5.4.390.0080.02914.08
5.4.380.0070.02314.09
5.4.370.0040.01814.04
5.4.360.0040.02914.09
5.4.350.0030.01814.14
5.4.340.0070.02014.09
5.4.330.0020.00811.62
5.4.320.0100.02214.09
5.4.310.0040.01714.06
5.4.300.0070.01614.09
5.4.290.0040.02214.04
5.4.280.0060.01814.13
5.4.270.0050.01514.09
5.4.260.0030.02614.09
5.4.250.0070.02214.06
5.4.240.0040.02814.15
5.4.230.0030.03014.04
5.4.220.0060.02714.11
5.4.210.0040.02914.12
5.4.200.0050.02114.09
5.4.190.0060.02114.12
5.4.180.0050.02414.11
5.4.170.0010.03114.13
5.4.160.0030.02114.09
5.4.150.0040.03114.13
5.4.140.0090.02613.24
5.4.130.0050.02813.25
5.4.120.0060.02113.24
5.4.110.0020.02613.23
5.4.100.0060.01913.25
5.4.90.0060.02813.27
5.4.80.0030.03213.19
5.4.70.0040.02913.26
5.4.60.0050.02913.25
5.4.50.0060.02713.22
5.4.40.0060.01813.18
5.4.30.0090.02513.23
5.4.20.0040.02513.23
5.4.10.0010.03213.23
5.4.00.0050.02913.06
5.3.290.0060.03112.66
5.3.280.0030.02812.63
5.3.270.0070.02212.62
5.3.260.0050.02412.61
5.3.250.0060.01912.66
5.3.240.0030.03112.61
5.3.230.0050.02712.63
5.3.220.0030.02812.61
5.3.210.0050.03112.60
5.3.200.0070.01612.60
5.3.190.0020.02012.58
5.3.180.0040.02612.63
5.3.170.0020.02012.63
5.3.160.0060.02812.59
5.3.150.0030.02312.61
5.3.140.0030.02912.58
5.3.130.0020.03012.59
5.3.120.0020.02012.62
5.3.110.0030.02912.64
5.3.100.0080.02612.43
5.3.90.0040.02712.41
5.3.80.0080.02312.39
5.3.70.0070.02112.40
5.3.60.0060.01512.38
5.3.50.0070.02112.44
5.3.40.0050.02512.39
5.3.30.0030.02512.36
5.3.20.0080.01912.32
5.3.10.0020.03012.30
5.3.00.0070.02612.30
5.2.170.0030.02312.30
5.2.160.0020.01712.30
5.2.150.0030.02412.30
5.2.140.0030.02512.30
5.2.130.0070.01812.30
5.2.120.0060.02212.30
5.2.110.0030.02212.30
5.2.100.0070.02112.30
5.2.90.0040.01112.30
5.2.80.0010.01612.30
5.2.70.0080.01412.30
5.2.60.0040.01412.30
5.2.50.0080.01112.30
5.2.40.0030.01712.30
5.2.30.0040.01312.30
5.2.20.0050.01512.30
5.2.10.0060.02212.30
5.2.00.0050.01712.30
5.1.60.0040.01512.30
5.1.50.0030.01712.30
5.1.40.0040.01212.30
5.1.30.0070.01912.30
5.1.20.0020.02412.30
5.1.10.0020.01512.30
5.1.00.0050.01612.30
5.0.50.0040.01212.30
5.0.40.0020.01912.30
5.0.30.0010.01912.30
5.0.20.0030.01812.30
5.0.10.0070.00812.30
5.0.00.0050.02212.30
4.4.90.0040.00712.30
4.4.80.0000.00812.30
4.4.70.0020.00712.30
4.4.60.0020.01212.30
4.4.50.0010.01012.30
4.4.40.0050.01412.30
4.4.30.0000.01112.30
4.4.20.0040.01412.30
4.4.10.0030.01412.30
4.4.00.0030.01212.30
4.3.110.0050.00912.30
4.3.100.0020.01612.30
4.3.90.0030.01012.30
4.3.80.0010.01412.30
4.3.70.0020.01412.30
4.3.60.0020.01112.30
4.3.50.0040.01012.30
4.3.40.0020.02012.30
4.3.30.0030.01112.30
4.3.20.0010.01112.30
4.3.10.0030.00812.30
4.3.00.0000.01212.30

preferences:
41.1 ms | 400 KiB | 5 Q