[Typo3-dev] Getting rid of preg_* function

Karsten Dambekalns karsten at typo3.org
Mon Mar 28 22:46:13 CEST 2005


Hi.

Michael Stucki wrote:
> Christian Jul Jensen wrote:
>>> - Are the PCRE functions faster than the Posix ereg_* functions?
>> 
>> yes, should be approx twice as fast.
> 
> OK then I better won't change it. But then we should also use these
> functions more often.

Yes. When working on DBAL I changed whatever ereg_* I found into an
equivalent preg_* call. I discussed this with Kasper, and his use of ereg_*
isn't the result of a clear preference, but caused by habit. He knows it
works, and never cared to look for an alternative. When I pointed out the
speed advantage, he agreed with using it more immediately.

So, no, we should definitely not use ereg_* because it may work on
(slightly) more setups. And yes, we should actively change ereg_* to preg_*
even more. But this should not be done automatically (might be possible
without too much hassle) - because if you look at the code, you sometimes
see places where some ereg_replace can be done even faster by a simple
str_replace or a clever usage of trim() with supplying the needed
parameters.

Question: who looks at the CGL and submits a proposal for including this? If
I may, I'd *not* volunteer this time, I have to clean up my existing todo
list first... :)

Regards,
Karsten
-- 
Karsten Dambekalns
TYPO3 Association - Active Member
http://association.typo3.org/




More information about the TYPO3-dev mailing list