3v4l.org

run code in 300+ PHP versions simultaneously
<?php //bk2020 cc0 // SipHash-2-4 // Aumasson and Bernstein 2012, https://131002.net/siphash/ // https://github.com/jedisct1/libsodium/tree/master/src/libsodium/crypto_shorthash // https://github.com/php/php-src/tree/master/ext/sodium/libsodium.c#L472 function bytes_as_hex(&$str, $len=null) { if( !$len ) { $len = strlen($str); } // zero-based array index for unpack, kennwhite 2005: // https://www.php.net/manual/en/function.unpack.php#45188 $arrhead = array_merge( unpack('C*', substr($str,0,$len)) ); return array_reduce( $arrhead, function($a,$b) { return ($b>15) ? $a.dechex($b) : $a.'0'.dechex($b); }, '' ); } $SIPHASH = null; if( function_exists('\sodium_crypto_shorthash') ) { $SIPHASH = 'sodium_crypto_shorthash'; } else if( function_exists('\Sodium\crypto_shorthash') ) { $SIPHASH = '\Sodium\crypto_shorthash'; } else { die('Unable to test SipHash-2-4 using sodium_crypto_shorthash'); } $SIPKEY = '1234567890abcdef'; // 16-byte key for SipHash-2-4 echo '# ', $SIPHASH, PHP_EOL; // thanks to: https://3v4l.org/EsGSU // (note: bin2hex won't print leading zero on byte values <16) for ($i = 0; $i < 256; ++$i) { $hsh = $SIPHASH( bin2hex(chr(($i & 0x3F) | 0x80)), $SIPKEY ); echo $i, "\t", bytes_as_hex($hsh,8), PHP_EOL; }

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)
8.3.60.0160.01018.55
8.3.50.0070.01418.11
8.3.40.0220.00320.33
8.3.30.0140.00318.71
8.3.20.0100.01324.18
8.3.10.0060.00324.66
8.3.00.0180.00426.16
8.2.180.0070.01025.92
8.2.170.0100.00718.78
8.2.160.0040.01422.96
8.2.150.0110.01125.66
8.2.140.0060.01624.66
8.2.130.0220.00026.16
8.2.120.0060.00326.35
8.2.110.0070.00322.25
8.2.100.0090.00317.91
8.2.90.0060.00617.75
8.2.80.0030.00618.64
8.2.70.0100.00017.50
8.2.60.0060.00318.04
8.2.50.0060.00318.05
8.2.40.0030.00618.03
8.2.30.0040.00417.98
8.2.20.0060.00318.09
8.2.10.0080.00020.96
8.2.00.0040.00419.26
8.1.280.0100.00725.92
8.1.270.0100.00023.99
8.1.260.0060.00328.09
8.1.250.0100.01028.09
8.1.240.0050.00521.98
8.1.230.0130.00017.57
8.1.220.0000.00917.78
8.1.210.0030.00618.77
8.1.200.0090.00017.35
8.1.190.0030.00617.23
8.1.180.0030.00718.10
8.1.170.0100.00017.62
8.1.160.0050.00318.97
8.1.150.0030.00518.84
8.1.140.0050.00319.00
8.1.130.0000.00820.16
8.1.120.0000.01017.50
8.1.110.0030.00617.34
8.1.100.0060.00617.37
8.1.90.0050.00517.44
8.1.80.0030.00617.39
8.1.70.0000.00817.49
8.1.60.0040.00417.56
8.1.50.0030.00617.54
8.1.40.0030.00617.54
8.1.30.0100.00017.67
8.1.20.0060.00317.67
8.1.10.0000.00917.65
8.1.00.0000.00917.58
8.0.300.0050.00318.77
8.0.290.0000.00916.63
8.0.280.0030.00618.52
8.0.270.0040.00418.04
8.0.260.0060.00318.47
8.0.250.0000.00816.94
8.0.240.0000.00816.87
8.0.230.0070.00016.95
8.0.220.0080.00316.89
8.0.210.0000.00816.94
8.0.200.0040.00416.97
8.0.190.0050.00316.95
8.0.180.0000.00916.96
8.0.170.0060.00316.83
8.0.160.0040.00417.00
8.0.150.0030.00716.89
8.0.140.0000.00916.86
8.0.130.0030.00313.36
8.0.120.0090.00016.91
8.0.110.0040.00416.95
8.0.100.0000.00816.91
8.0.90.0040.00416.72
8.0.80.0060.01216.84
8.0.70.0000.01017.02
8.0.60.0000.01016.79
8.0.50.0040.00416.94
8.0.30.0250.00017.18
8.0.20.0230.00517.01
8.0.10.0040.00416.98
8.0.00.0090.01316.77
7.4.330.0020.00215.55
7.4.320.0000.00716.63
7.4.300.0000.00716.63
7.4.290.0030.00616.67
7.4.280.0060.00316.51
7.4.270.0080.00016.45
7.4.260.0030.00313.30
7.4.250.0000.00816.57
7.4.240.0060.00316.68
7.4.230.0030.00616.44
7.4.220.0040.00416.59
7.4.210.0110.01016.55
7.4.200.0060.00316.71
7.4.130.0180.00816.60
7.4.120.0060.02216.50
7.4.110.0140.01116.56
7.4.100.0040.01816.54
7.4.90.0160.00716.48
7.4.80.0110.01116.40
7.4.70.0100.01716.62
7.4.60.0160.00816.59
7.4.50.0100.01716.55
7.4.40.0070.01516.41
7.4.30.0100.01716.43
7.4.20.0100.01616.65
7.4.10.0160.01316.65
7.4.00.0180.01416.65
7.3.330.0080.00016.41
7.3.320.0030.00513.31
7.3.310.0000.00716.41
7.3.300.0040.00416.40
7.3.290.0130.01016.38
7.3.260.0160.00816.54
7.3.230.0200.00916.34
7.3.220.0060.01616.16
7.3.210.0160.00916.41
7.3.200.0060.01716.54
7.3.190.0080.01516.30
7.3.180.0150.01216.54
7.3.170.0100.01716.59
7.3.160.0190.01216.29
7.3.150.0130.01016.45
7.3.140.0100.02116.51
7.3.130.0120.01216.45
7.3.120.0160.01616.70
7.3.110.0190.00516.42
7.3.100.0170.01016.30
7.3.90.0150.00916.28
7.3.80.0070.01916.31
7.3.70.0140.01416.29
7.3.60.0100.01616.47
7.3.50.0110.01516.45
7.3.40.0100.02116.40
7.3.30.0090.01316.36
7.3.20.0160.01016.14
7.3.10.0200.00316.32
7.3.00.0140.00816.48
7.2.330.0060.02316.79
7.2.320.0110.01116.69
7.2.310.0160.01016.72
7.2.300.0190.00816.88
7.2.290.0060.02616.74
7.2.280.0060.01816.93
7.2.270.0130.01016.87
7.2.260.0120.01416.56
7.2.250.0170.00716.63
7.2.240.0030.02116.60
7.2.230.0160.00916.72
7.2.220.0270.00616.74
7.2.210.0150.01516.54
7.2.200.0190.01216.71
7.2.190.0180.00716.61
7.2.180.0130.02116.59
7.2.170.0090.01716.63
7.2.160.0130.01016.69
7.2.150.0110.01416.82
7.2.140.0160.01316.75
7.2.130.0290.01316.68
7.2.120.0150.01916.84
7.2.110.0100.01316.80
7.2.100.0130.02016.62
7.2.90.0100.01616.66
7.2.80.0100.01716.60
7.2.70.0060.01916.91
7.2.60.0140.01116.72
7.2.50.0140.01016.52
7.2.40.0090.01616.72
7.2.30.0060.01916.76
7.2.20.0190.00716.59
7.2.10.0110.01416.81
7.2.00.0090.01916.70

preferences:
31.12 ms | 401 KiB | 5 Q