From:             DPP <paul dot dovbush at gmail dot com>
Operating system: WinXPsp2
PHP version:      5.2.1
PHP Bug Type:     PCRE related
Bug description:  PCRE_UTF8 slows down 30 times

Description:
------------
Parsing file with 10000 lines of following format:

level + delim + [EMAIL PROTECTED]@ + 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+) +(@([EMAIL PROTECTED])@ +)?([^ \\n]+)( +@([EMAIL 
PROTECTED])@
*| +[^\\n]*)?$/m",$fp,$m,PREG_PATTERN_ORDER);
But it changes nothing.


-- 
Edit bug report at http://bugs.php.net/?id=41216&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41216&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41216&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41216&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41216&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41216&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41216&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41216&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41216&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41216&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41216&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41216&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41216&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41216&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41216&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41216&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41216&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41216&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41216&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41216&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41216&r=mysqlcfg

Reply via email to