Bug #79024 [Opn->Dup]: very slow hash('sha1', ...)

From: Date: Tue, 24 Dec 2019 10:32:09 +0000
Subject: Bug #79024 [Opn->Dup]: very slow hash('sha1', ...)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224514@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79024&edit=1 ID: 79024 Updated by: cmb@php.net Reported by: bugzilla77 at gmail dot com Summary: very slow hash('sha1', ...) -Status: Open +Status: Duplicate Type: Bug Package: hash related Operating System: Windows 10 PHP Version: 7.4.1 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Closing as duplicate of bug #79023, since the behavior has the same root cause. Previous Comments: ------------------------------------------------------------------------ [2019-12-24 00:11:18] bugzilla77 at gmail dot com 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79024&edit=1

« previous php.bugs (#224514) next »