php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40559 UTF-8 PCRE process speed too slowly
Submitted: 2007-02-20 15:10 UTC Modified: 2007-02-20 17:27 UTC
From: hunreal at gmail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.1 OS: FreeBSD 6.2, Windows
Private report: No CVE-ID: None
 [2007-02-20 15:10 UTC] hunreal at gmail dot com
Description:
------------
From PHP 5.2.0, I found the speed of PCRE process UTF-8 pattern is too slowly.

Reproduce code:
---------------
http://www.hshh.org/temp/test.phps
Script is UTF-8 Simplified Chinese string pcre_replace testing.
I was also tested replace PCRE lib of php 5.2.0 from 6.7 to 6.6 not bundled, no different result.

Expected result:
----------------
FreeBSD, PHP 5.2.1, process time: 3.76s (dual p3-1.26G).
Windows2003, PHP 5.2.0, process time: 17.91s (Pentium-M 1.7G)
If I don't set 'pcre.backtrack_limit' to '-1', script will break pcre_replace.

Actual result:
--------------
PHP 5.1.6 at FreeBSD, process time: 0.93s

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-20 15:22 UTC] tony2001@php.net
The processing is done by PCRE library, not PHP.
Please report this problem to PCRE developers.
 [2007-02-20 17:27 UTC] hunreal at gmail dot com
I tested php 5.2.1 compiled with pcre 6.6, 6.7(bundled) and 7.0 on dual P3-1.13G, Freebsd 6.2.

php 5.1.6 with bundled pcre 6.6, process time is 1.03s.
php 5.2.1 with bundled pcre 6.7, process time is 4.07s.
php 5.2.1 with pcre 6.6, process time is 4.38s.
php 5.2.1 with pcre 7.0, process time is 2.43s.

CFLAGS and CXXFLAGS is '-O2 -pipe -fno-strict-aliasing'
PCRE is compiled by './configure --enable-utf8 --enable-unicode-properties'.
PHP configure command, './configure' '--disable-debug' '--enable-inline-optimization' '--with-zlib' '--enable-zend-multibyte' '--enab
le-mbregex' '--enable-mbstring=all' '--disable-cgi' '--with-iconv=/usr/local' '--with-l
ibxml-dir=/usr/local'
I use --with-pcre-regex=DIR to specify DIR where PCRE's include and library files are located.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 07:00:01 2025 UTC