#41216 [Opn->Bgs]: PCRE_UTF8 slows down 30 times
| From: | tony2001@php.net | Date: | Fri, 27 Apr 2007 17:43:50 +0000 |
| Subject: | #41216 [Opn->Bgs]: PCRE_UTF8 slows down 30 times | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112015@lists.php.net to get a copy of this message | ||
ID: 41216
Updated by: tony2001@php.net
Reported By: DPP <paul dot dovbush at gmail dot com>
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: WinXPsp2
PHP Version: 5.2.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2007-04-27 17:33:54] DPP <paul dot dovbush at gmail dot com>
Forgot to say: file contain russian text encoded in UTF-8.
Without PCRE_UTF8 modifier regexp falls on russian letter "R".
------------------------------------------------------------------------
[2007-04-27 17:26:59] DPP <paul dot dovbush at gmail dot com>
Description:
------------
Parsing file with 10000 lines of following format:
level + delim + [@xref_id@ + delim +] tag + [delim + line_value +]
terminator
level digit
delim space
xref_id alphanum
tag alpha (english)
line_value any (except terminator)
terminator \r\n
With regexp:
$c=preg_match_all("/^\s*(\d+)\s+(@(\S+)@\s+)?(\w+)(\s+@(\S+)@\s*|.*)?$/Sm",$fp,$m,PREG_PATTERN_ORDER);
Setting PCRE_UTF8 modifier slows whole script down 30 times (from 300ms
to 9000ms).
May be more accurate regexp here will be
$c=preg_match_all("/^ *(\d+) +(@([^@\\n]+)@ +)?([^ \\n]+)(
+@([^@\\n]+)@ *| +[^\\n]*)?$/m",$fp,$m,PREG_PATTERN_ORDER);
But it changes nothing.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41216&edit=1