|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77095 slowness regression in 7.2/7.3 (compared to 7.1)
Submitted: 2018-11-02 13:13 UTC Modified: 2018-11-05 21:59 UTC
From: Assigned: ab (profile)
Status: Closed Package: PCRE related
PHP Version: 7.2.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
16 - 2 = ?
Subscribe to this entry?

 [2018-11-02 13:13 UTC]
When pcre.jit=1 everything is ok
With pcre.jit=0 we encounter slowness

From valgrind / kcachegrind results,
99% spent in php_pcre_math_impl (in pcre_exec for 7.2 or php_pcre2_match for 7.3)

Test script:
printf("PHP version %s\n", PHP_VERSION);
printf("pcre.jit=%d\n", ini_get('pcre.jit'));
$fd = __DIR__.'/data';
$a = str_repeat("\n", 1000000);
file_put_contents($fd, $a);
$fi = finfo_open(FILEINFO_NONE);
$t = microtime(true);
var_dump(finfo_file($fi, $fd));
printf("Time = %.4f\n", microtime(true) - $t);

Expected result:
PHP version 7.1.24RC1
string(10) "ASCII text"
Time = 0.0147

Actual result:
PHP version 7.2.12RC1
string(10) "ASCII text"
Time = 0,0172

PHP version 7.2.12RC1
string(10) "ASCII text"
Time = 0,6555

40 times slower

PHP version 7.3.0RC4
string(10) "ASCII text"
Time = 0.0177

PHP version 7.3.0RC4
string(10) "ASCII text"
Time = 2.2364

126 times slower


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-02 13:14 UTC]
-Assigned To: +Assigned To: ab
 [2018-11-05 21:59 UTC]
-Status: Assigned +Status: Closed
 [2018-11-05 21:59 UTC]
A fix was put to libmagic.;a=commit;h=c621182c42a36975970586cfc294bc5a80ba08cb;a=commit;h=7f5f46013b8a37bab6b378903aace5da9ce8dc5e

Further diff in libmagic versions might tell some difference. It seems to give an acceptable performance with the given reproduce case, though. Thus, this should be ok to close for now.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 07:01:24 2020 UTC