Bug #72640 [Csd->Nab]: Regexp with possessive/atomic grouping 25x slower compared to 5.6.x
| From: | leigh@php.net | Date: | Thu, 21 Jul 2016 22:20:09 +0000 |
| Subject: | Bug #72640 [Csd->Nab]: Regexp with possessive/atomic grouping 25x slower compared to 5.6.x | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202491@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72640&edit=1
ID: 72640
Updated by: leigh@php.net
Reported by: arjen at parse dot nl
Summary: Regexp with possessive/atomic grouping 25x slower
compared to 5.6.x
-Status: Closed
+Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: Linux
PHP Version: 7.0.9
-Assigned To: leigh
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2016-07-21 22:19:48] leigh@php.net
Ignore me. Backref. I'm an idiot.
------------------------------------------------------------------------
[2016-07-21 22:18:18] leigh@php.net
Not PCRE related.
Running it without the concat of 'x' results in normal performance:
https://3v4l.org/QbJP1/perf#tabs
<?php
preg_replace('~(?>[\pZ\pC]+)$~u', '', str_repeat("\u{2029}",
20000));
------------------------------------------------------------------------
[2016-07-21 14:58:29] bwoebi@php.net
I recommend using (*SKIP) though - this is the fastest you'll get.
preg_replace('~[\pZ\pC]+(*SKIP)$~u', '', str_repeat("\u{2029}", 20000)
. 'x');
------------------------------------------------------------------------
[2016-07-21 14:54:14] arjen at parse dot nl
\u{2029} is a PHP7 feature, so test in 5.6 is not the same.. :-/
See https://3v4l.org/7Wfc5/perf#tabs
PHP7 is faster. Regexp still slow, but no regression.
Please close :X
------------------------------------------------------------------------
[2016-07-21 14:22:27] cmb@php.net
> Please take a look at the user time, not at system time.
Ah, you're right!
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72640
--
Edit this bug report at https://bugs.php.net/bug.php?id=72640&edit=1