|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-12-24 10:32 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2019-12-24 10:32 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 15:00:02 2025 UTC |
Description: ------------ very slow hash('sha1', ...) Test script: --------------- <?php $i=2000000; $x=sha1(microtime(1).mt_rand()); $time_a=microtime(true); for($z=0;$z<$i;$z++){ $a=sha1($x); } $time_a=microtime(true)-$time_a; $time_b=microtime(true); for($z=0;$z<$i;$z++){ $b=hash('sha1',$x); } $time_b=microtime(true)-$time_b; $time_c=microtime(true); for($z=0;$z<$i;$z++){ $c=hash('sha1',$x,true); } $time_c=microtime(true)-$time_c; print($time_a.' sec'); print('<br/>'); print($time_b.' sec'); print('<br/>'); print($time_c.' sec'); ?> Expected result: ---------------- 0.98706293106079 sec <=0.98706293106079 sec <=0.98706293106079 sec Actual result: -------------- 0.98706293106079 sec 1.248526096344 sec 1.1808590888977 sec