Bug #79023 [NEW]: very slow hash('crc32b', ...)
| From: | bugzilla77 at gmail dot com | Date: | Tue, 24 Dec 2019 00:07:44 +0000 |
| Subject: | Bug #79023 [NEW]: very slow hash('crc32b', ...) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224502@lists.php.net to get a copy of this message | ||
From: bugzilla77 at gmail dot com
Operating system: Windows 10
PHP version: 7.4.1
Package: hash related
Bug Type: Bug
Bug description:very slow hash('crc32b', ...)
Description:
------------
very slow hash('crc32b', ...)
Test script:
---------------
<?php
$i=2000000;
$x=sha1(microtime(1).mt_rand());
$time_a=microtime(true);
for($z=0;$z<$i;$z++){
$a=crc32($x);
}
$time_a=microtime(true)-$time_a;
$time_b=microtime(true);
for($z=0;$z<$i;$z++){
$b=hash('crc32b',$x);
}
$time_b=microtime(true)-$time_b;
$time_c=microtime(true);
for($z=0;$z<$i;$z++){
$c=hash('crc32b',$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.34135699272156 sec
<=0.34135699272156 sec
<=0.34135699272156 sec
Actual result:
--------------
0.34135699272156 sec
0.77139401435852 sec
0.80676794052124 sec
--
Edit bug report at https://bugs.php.net/bug.php?id=79023&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79023&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79023&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79023&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79023&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79023&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79023&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79023&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79023&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79023&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79023&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79023&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79023&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79023&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79023&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79023&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79023&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79023&r=mysqlcfg