Req #73277 [NEW]: crc32() not using CPU capabilities

From: Date: Sun, 09 Oct 2016 16:45:12 +0000
Subject: Req #73277 [NEW]: crc32() not using CPU capabilities
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204570@lists.php.net to get a copy of this message
From: spam2 at rhsoft dot net Operating system: Linux PHP version: 7.0.11 Package: Performance problem Bug Type: Feature/Change Request Bug description:crc32() not using CPU capabilities Description: ------------ for short messages crc32 seems to be the fastest way but for long messages like a whole page content for a ETAG-HTTP-Header it's the slowest md5: 0.48954606056213 sha1: 0.57872104644775 crc32: 0.64182901382446 that should not be the case on modern Intel CPUs like SnadyBrdige or newer which support a accelerated instruction Test script: --------------- $test_content = file_get_contents('global.inc.php', true); echo '<strong>md5: </strong>' . md5($test_content) . MY_LE; $profiler->reset(); for($x=1;$x<5000;$x++) { $rw = md5($test_content); } echo $profiler->get() . '<br /><br />' . MY_LE; echo '<strong>sha1: </strong>' . sha1($test_content) . MY_LE; $profiler->reset(); for($x=1;$x<5000;$x++) { $rw = sha1($test_content); } echo $profiler->get() . '<br /><br />' . MY_LE; echo '<strong>crc32: </strong>' . abs(crc32($test_content)) . MY_LE; $profiler->reset(); for($x=1;$x<5000;$x++) { $rw = crc32($test_content); } echo $profiler->get() . '<br /><br />' . MY_LE; -- Edit bug report at https://bugs.php.net/bug.php?id=73277&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73277&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73277&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73277&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73277&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73277&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73277&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73277&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73277&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73277&r=support Expected behavior: https://bugs.php.net/fix.php?id=73277&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73277&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73277&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73277&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73277&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73277&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73277&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73277&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73277&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73277&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73277&r=mysqlcfg

« previous php.bugs (#204570) next »