ID: 11018 User Update by: [EMAIL PROTECTED] Status: Open Bug Type: Performance problem Operating system: Linux PHP Version: 4.0.4pl1 Description: ereg_replace takes a preposterous amount of time w.r.t. PHP3 > What is that second regex doing? It looks like there is missing \\ in there. There are backslashes missing everywhere, apparently eaten by the submission form. I tried with preg_replace() and everything works fine now. However I would like to hear an official comment about this: if this is a "normal" status for the ereg_* family, I'll stop using it. Performance is simply unacceptable. I am a bit uncomfortable about using Perl stuff. POSIX is a standard, Perl is not. But if the word is "drop ereg", it's OK anyway. Previous Comments: --------------------------------------------------------------------------- [2001-05-22 10:02:25] [EMAIL PROTECTED] What is that second regex doing? It looks like there is a missing in there. Just for testing, have you tried using preg_replace instead of ereg. The preg functions are faster and more reliable. --------------------------------------------------------------------------- [2001-05-22 09:50:52] [EMAIL PROTECTED] I suggest using preg_replace and try to splitup the $bib variabele into smaller parts (i.e. per line). Can you see if this works better for you? Derick --------------------------------------------------------------------------- [2001-05-22 09:45:22] [EMAIL PROTECTED] My publication page (http://gongolo.usr.dsi.unimi.it/~vigna/papers) 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^). --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=11018 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]