From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.0.4pl1
PHP Bug Type:     Performance problem
Bug description:  ereg_replace takes a preposterous amount of time w.r.t. PHP3

My publication page
( is generated
with PHP. Part of the generation process includes the
following regular expression substitutions:

$bib = ereg_replace("([0-9]+)--([0-9]+)", "\\1-\\2",$bib); 
$bib = ereg_replace("\{((['`\]|\w)+)\}", "\\1", $bib);

$bib is a variable containig about 20K of text generated by
a BibTeX style. Everything worked fine with PHP 3, but since
I installed PHP 4, the page is output in >20 seconds.
Indeed, there where other 10 substitutions, and initially
the page wouldn't simply display because of server timeout.
I changed whenever possible ereg_replace to str_replace, but
of course the two substitutions above need regular
expressions. They increase the page serving time of about
15s. Computation time was negligible with PHP 3.

The strange thing is that the page is _serverd_ slowly. One
would expect that there is a long wait, and then the page is
served all at one time. Instead, there is a long wait, and
then the page is served slowly. Eliminating the two regular
expressions above solves the problem (but serves the wrong
page 8^).

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to