3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EmptySetter { public $foo = NULL; public function __set($name, $value) {} } class NonEmptySetter { public function __set($name, $value) { $this->{$name} = $value; } } function benchmark($class_name) { $start_time = microtime(TRUE); for ($i = 0; $i < 1000000; $i++) { $obj = new $class_name(); $obj->foo = 42; } return microtime(TRUE) - $start_time; } printf("NonEmptySetter: %.2f seconds\n", benchmark('NonEmptySetter')); printf("EmptySetter: %.2f seconds\n", benchmark('EmptySetter'));

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.0070.67215.08
7.4.00.0030.60814.82
7.3.130.0000.57314.92
7.3.120.0030.64615.09
7.3.110.0070.40514.72
7.3.100.0030.49514.67
7.3.90.0030.54314.58
7.3.80.0030.55714.91
7.3.70.0030.53314.75
7.3.60.0030.61314.92
7.3.50.0070.53614.63
7.3.40.0070.37914.86
7.3.30.0030.57514.94
7.3.20.0030.39716.79
7.3.10.0000.43016.21
7.3.00.0070.53916.54
7.2.260.0070.69815.29
7.2.250.0070.73015.08
7.2.240.0000.44515.09
7.2.230.0070.41814.99
7.2.220.0030.57615.17
7.2.210.0000.42614.98
7.2.200.0000.40515.15
7.2.190.0030.64914.85
7.2.180.0070.47415.11
7.2.170.0000.53715.08
7.2.160.0070.65115.05
7.2.150.0100.56417.04
7.2.140.0070.64117.01
7.2.130.0030.68816.75
7.2.120.0000.67217.16
7.2.110.0030.42017.08
7.2.100.0030.48116.95
7.2.90.0030.61217.06
7.2.80.0070.64417.00
7.2.70.0000.45016.98
7.2.60.0030.72317.02
7.2.50.0030.59517.10
7.2.40.0030.64716.86
7.2.30.0000.41916.82
7.2.20.0070.58217.06
7.2.10.0100.43517.02
7.2.00.0030.42317.09
7.1.330.0030.75015.87
7.1.320.0000.58716.05
7.1.310.0030.80415.96
7.1.300.0070.88015.70
7.1.290.0000.88815.77
7.1.280.0030.64315.89
7.1.270.0130.89515.88
7.1.260.0000.64915.77
7.1.250.0030.80515.79
7.1.240.0030.85415.64
7.1.230.0030.81015.89
7.1.220.0070.88515.56
7.1.210.0000.68015.83
7.1.200.0000.79715.84
7.1.190.0030.87515.80
7.1.180.0000.61915.59
7.1.170.0000.82515.81
7.1.160.0100.88915.57
7.1.150.0070.69015.82
7.1.140.0000.88515.58
7.1.130.0030.92015.85
7.1.120.0100.83815.73
7.1.110.0030.92016.06
7.1.100.0070.79815.89
7.1.90.0030.66015.56
7.1.80.0030.86415.92
7.1.70.0020.58416.53
7.1.60.0080.56816.35
7.1.50.0100.64216.48
7.1.40.0070.88115.52
7.1.30.0100.82615.88
7.1.20.0100.65015.82
7.1.10.0070.84215.75
7.1.00.0030.68519.10
7.0.330.0100.84615.20
7.0.320.0070.96815.37
7.0.310.0000.90515.42
7.0.300.0100.89115.39
7.0.290.0000.90815.56
7.0.280.0070.84115.61
7.0.270.0030.91015.39
7.0.260.0001.01615.36
7.0.250.0000.99315.59
7.0.240.0070.79915.20
7.0.230.0030.97715.39
7.0.220.0070.75115.39
7.0.210.0100.86915.57
7.0.200.0020.77016.14
7.0.190.0030.86715.52
7.0.180.0001.08115.36
7.0.170.0031.00115.51
7.0.160.0030.90315.58
7.0.150.0100.69015.49
7.0.140.0030.65018.74
7.0.130.0070.67815.29
7.0.120.0031.08415.40
7.0.110.0030.76315.49
7.0.100.0071.04215.21
7.0.90.0030.74715.46
7.0.80.0000.97815.18
7.0.70.0030.85215.44
7.0.60.0120.66317.69
7.0.50.0070.63416.73
7.0.40.0030.63016.85
7.0.30.0080.66616.90
7.0.20.0150.74516.93
7.0.10.0200.70616.71
7.0.00.0050.77516.95
5.6.400.0031.48514.39
5.6.390.0071.60414.85
5.6.380.0031.52314.66
5.6.370.0071.28014.29
5.6.360.0071.56214.29
5.6.350.0001.55814.70
5.6.340.0071.65414.61
5.6.330.0031.37413.97
5.6.320.0031.40114.64
5.6.310.0001.67114.41
5.6.300.0101.69714.38
5.6.290.0031.66714.11
5.6.280.0071.19117.75
5.6.270.0071.30614.27
5.6.260.0001.35214.57
5.6.250.0071.68014.30
5.6.240.0031.39414.34
5.6.230.0031.39614.28
5.6.220.0071.74314.32
5.6.210.0031.20817.58
5.6.200.0071.24416.32
5.6.190.0051.08817.38
5.6.180.1801.08617.46
5.6.170.0151.16917.44
5.6.160.0081.10117.45
5.6.150.0081.13916.28
5.6.140.0071.13516.19
5.6.130.0071.25316.38
5.6.120.0031.21717.71
5.6.110.0071.13417.70
5.6.100.0071.15917.81
5.6.90.0041.07017.72
5.6.80.0101.16417.48
5.6.70.1501.14517.32
5.6.60.0001.65114.17
5.6.50.0031.53114.25
5.6.40.0001.57814.10
5.6.30.0031.69814.56
5.6.20.0101.53614.40
5.6.10.0001.69414.43
5.6.00.0021.55914.63
5.5.380.0071.69314.25
5.5.370.0071.18014.39
5.5.360.0071.40914.01
5.5.350.0031.26917.35
5.5.340.0071.25816.17
5.5.330.0121.01517.27
5.5.320.0071.27017.51
5.5.310.0081.24517.23
5.5.300.0021.15315.98
5.5.290.0031.20315.94
5.5.280.0051.25917.60
5.5.270.0081.01217.48
5.5.260.0031.05617.73
5.5.250.0061.13117.21
5.5.240.0021.12717.12
5.5.230.0031.80113.97
5.5.220.0071.28314.41
5.5.210.0071.55914.50
5.5.200.0071.23414.13
5.5.190.0101.66114.12
5.5.180.0031.34514.33
5.5.170.0001.15714.14
5.5.160.0071.23914.07
5.5.150.0001.72113.98
5.5.140.0001.76514.16
5.5.130.0071.17814.20
5.5.120.0101.73214.37
5.5.110.0031.45513.98
5.5.100.0101.72914.02
5.5.90.0071.15614.48
5.5.80.0101.24514.16
5.5.70.0071.41814.47
5.5.60.0031.22514.34
5.5.50.0031.68014.09
5.5.40.0031.64113.84
5.5.30.0001.39714.36
5.5.20.0171.46413.87
5.5.10.0031.25014.35
5.5.00.0101.75413.88
5.4.450.0181.40315.15
5.4.440.0371.40815.23
5.4.430.0081.48115.33
5.4.420.0071.36815.36
5.4.410.0101.26315.14
5.4.400.0031.29714.86
5.4.390.0071.20214.77
5.4.380.0181.24215.01
5.4.370.0101.40614.89
5.4.360.0151.36914.90
5.4.350.0201.19114.77
5.4.340.0101.30914.75
5.4.330.0031.76511.04
5.4.320.0071.06411.76
5.4.310.0061.24511.78
5.4.300.0051.22611.77
5.4.290.0081.24411.91
5.4.280.0081.17211.82
5.4.270.0071.45114.97
5.4.260.0131.56014.96
5.4.250.0081.53514.83
5.4.240.0101.40914.94
5.4.230.0061.54414.99
5.4.220.0101.54814.92
5.4.210.0031.40515.02
5.4.200.0051.54015.04
5.4.190.0081.57214.73
5.4.180.0081.35914.82
5.4.170.0081.45214.88
5.4.160.0031.67414.96
5.4.150.0081.55214.92
5.4.140.0051.49713.69
5.4.130.0051.33213.74
5.4.120.0101.73713.71
5.4.110.0021.40913.69
5.4.100.0101.57413.63
5.4.90.0101.47213.77
5.4.80.0071.45013.73
5.4.70.0081.54713.60
5.4.60.0071.73213.70
5.4.50.0051.62213.79
5.4.40.0051.17713.69
5.4.30.0101.22413.71
5.4.20.0051.43513.74
5.4.10.0201.65413.73
5.4.00.0021.77913.48
5.3.290.0041.51311.84
5.3.280.0101.76112.61
5.3.270.0121.62112.54
5.3.260.0051.83112.76
5.3.250.0101.50712.67
5.3.240.0101.86912.65
5.3.230.0081.57612.61
5.3.220.0121.67112.55
5.3.210.0081.62412.47
5.3.200.0101.57712.50
5.3.190.0081.68612.57
5.3.180.0201.83512.51
5.3.170.0101.96412.54
5.3.160.0101.81112.48
5.3.150.0101.76312.48
5.3.140.0121.72212.53
5.3.130.0071.93012.53
5.3.120.0051.80212.58
5.3.110.0271.83612.36
5.3.100.0021.63612.31
5.3.90.0101.56912.48
5.3.80.0031.86912.21
5.3.70.0081.94012.29
5.3.60.0081.84012.29
5.3.50.0091.78212.35
5.3.40.0101.86412.15
5.3.30.0081.76212.25
5.3.20.0071.77612.19
5.3.10.0201.78011.99
5.3.00.0131.70312.07
5.2.170.0202.06710.87
5.2.160.0232.02711.14
5.2.150.0202.02710.98
5.2.140.0402.08011.00
5.2.130.0301.83711.18
5.2.120.0172.04710.94
5.2.110.0102.13711.06
5.2.100.0101.94311.01
5.2.90.0231.93310.68
5.2.80.0271.87010.80
5.2.70.0132.21010.93
5.2.60.0372.05311.02
5.2.50.0131.63710.86
5.2.40.0201.95010.84
5.2.30.0072.20710.90
5.2.20.0202.01011.14
5.2.10.0171.93710.95
5.2.00.0302.33310.63
5.1.60.0202.16710.12
5.1.50.0071.80310.00
5.1.40.0201.7309.98
5.1.30.0032.00310.38
5.1.20.0132.09710.54
5.1.10.0131.85310.00
5.1.00.0201.74710.17
5.0.50.0072.4678.47
5.0.40.0072.4408.37
5.0.30.0032.3808.39
5.0.20.0102.3908.23
5.0.10.0072.4708.11
5.0.00.0072.4537.88
4.4.90.0000.0236.54
4.4.80.0000.0236.54
4.4.70.0070.0276.54
4.4.60.0030.0206.54
4.4.50.0000.0236.54
4.4.40.0000.0376.54
4.4.30.0070.0276.54
4.4.20.0000.0306.54
4.4.10.0070.0276.54
4.4.00.0000.0376.54
4.3.110.0070.0176.54
4.3.100.0100.0236.54
4.3.90.0070.0176.54
4.3.80.0070.0306.54
4.3.70.0100.0136.54
4.3.60.0030.0236.54
4.3.50.0100.0236.54
4.3.40.0100.0336.54
4.3.30.0030.0336.54
4.3.20.0030.0276.54
4.3.10.0000.0336.54
4.3.00.0130.0236.50

preferences:
39.92 ms | 400 KiB | 5 Q