Bug #79896 [NEW]: slower processing of non-fatal errors using custom error handler (7.4.7+)
| From: | tony dot jin at sbumed dot org | Date: | Sat, 25 Jul 2020 06:17:45 +0000 |
| Subject: | Bug #79896 [NEW]: slower processing of non-fatal errors using custom error handler (7.4.7+) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228220@lists.php.net to get a copy of this message | ||
From: tony dot jin at sbumed dot org
Operating system: Windows Server 2016
PHP version: 7.4.8
Package: Performance problem
Bug Type: Bug
Bug description:slower processing of non-fatal errors using custom error handler (7.4.7+)
Description:
------------
seeing 10-100x slower processing of non-fatal errors using custom error
handler function on 7.4.7-7.4.8 vs. 7.4.0-7.4.6.
https://3v4l.org/WcFJK/perf#output
not a c programmer, but i wonder if it could be caused by the following
7.4.6 bug fix:
https://bugs.php.net/bug.php?id=79599
Test script:
---------------
<?php
// see https://3v4l.org/WcFJK/perf#output
// 2020.07.25
// performance hit processing non-fatal errors w/ custom error handler
(e_notice, e_warning)
// affects versions 7.4.7 & 7.4.8
// array of seq. ints
$start = 3;
$number_of_values = 5000;
$seq_array = range($start, $start+$number_of_values-1);
// set error handler
function error_handler_fn($errno, $errstr, $errfile, $errline) {
$dummy = '0';
// print_r(implode(", ", Array($errno, $errstr, $errfile,
$errline))."\n");
}
set_error_handler("error_handler_fn");
// array to index
$array = Array(1,2,3);
// run loop
$t1 = microtime(true);
foreach ($seq_array as $val) {
$nothing = $array[$val]; // E_NOTICE (8) - try to index array at
undefined index (performance issue)
// $nothing2 = count(); // E_WARNING (2) - try to count nothing
(similar performance issue)
}
$t2 = microtime(true);
$outmsg = "\n\nRun time: " . round(($t2-$t1)*1000.,2) . " milliseconds
(" . phpversion() . ")";
print_r($outmsg);
?>
Expected result:
----------------
execution time comparable to 7.4.6 and earlier
Actual result:
--------------
execution time 10-100x longer on 7.4.7-7.4.8 than on 7.4.6 and earlier
--
Edit bug report at https://bugs.php.net/bug.php?id=79896&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79896&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79896&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79896&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79896&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79896&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79896&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79896&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79896&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79896&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79896&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79896&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79896&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79896&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79896&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79896&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79896&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79896&r=mysqlcfg