Bug #79896 [Asn->Csd]: slower processing of non-fatal errors using custom error handler (7.4.7+)
| From: | cmb@php.net | Date: | Fri, 31 Jul 2020 06:39:38 +0000 |
| Subject: | Bug #79896 [Asn->Csd]: slower processing of non-fatal errors using custom error handler (7.4.7+) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228351@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79896&edit=1
ID: 79896
Updated by: cmb@php.net
Reported by: tony dot jin at sbumed dot org
Summary: slower processing of non-fatal errors using custom
error handler (7.4.7+)
-Status: Assigned
+Status: Closed
Type: Bug
Package: Performance problem
Operating System: Windows Server 2016
PHP Version: 7.4.8
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Fine! :)
Previous Comments:
------------------------------------------------------------------------
[2020-07-31 06:07:13] tony dot jin at sbumed dot org
The performance issue seems to be resolved on 7.4.9 RC1.
Thank you for the great news and fast turnaround!
------------------------------------------------------------------------
[2020-07-25 12:05:41] cmb@php.net
I think that has been fixed in the meantime[1]. Could you please
try with PHP 7.4.9RC1[2]?
[1] <http://git.php.net/?p=php-src.git;a=commit;h=5795dfda93d1f60cce4731e2089ad5975a6c062f>
[2] <https://windows.php.net/qa#php-7.4>
------------------------------------------------------------------------
[2020-07-25 06:17:44] tony dot jin at sbumed dot org
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 this bug report at https://bugs.php.net/bug.php?id=79896&edit=1