Bug #77536 [NEW]: finfo considerably slower on 7.3 vs. 7.2
| From: | jscaltreto at gmail dot com | Date: | Mon, 28 Jan 2019 23:57:04 +0000 |
| Subject: | Bug #77536 [NEW]: finfo considerably slower on 7.3 vs. 7.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219260@lists.php.net to get a copy of this message | ||
From: jscaltreto at gmail dot com
Operating system:
PHP version: 7.3.1
Package: Filesystem function related
Bug Type: Bug
Bug description:finfo considerably slower on 7.3 vs. 7.2
Description:
------------
Calls via finfo to lookup mimetype of files take 30%+ longer to run on
php 7.3+ than on 7.2. In an extreme case on a cpu-loaded machine I've
observed finfo->file() calls taking upwards of 500ms in 7.3, where on
the same hardware with the same load the calls typically take <1ms for
the same file in 7.2.
The included test script can be executed in both 7.2 and 7.3 to
illustrate the problem. I've also created a simple test using official
docker images to reproduce the issue:
https://gist.github.com/jscaltreto/8f6adf38e7abb08a831ef37b84c14ace
Test script:
---------------
<?php
$iters = 1000;
$start = microtime(true);
for ($i = 1; $i <= $iters; $i++){
$finfo = new finfo(FILEINFO_MIME);
$type = $finfo->file("/bin/sh");
unset($finfo);
}
$ttl = microtime(true) - $start;
echo "Took: $ttl\n";
?>
Expected result:
----------------
7.2 and 7.3 should execute the script in roughly the same amount of
time.
Actual result:
--------------
7.3 takes 30%+ more time to execute.
--
Edit bug report at https://bugs.php.net/bug.php?id=77536&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77536&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77536&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77536&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77536&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77536&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77536&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77536&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77536&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77536&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77536&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77536&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77536&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77536&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77536&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77536&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77536&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77536&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77536&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77536&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77536&r=mysqlcfg