[TYPO3-core] RFC #14997: Performance: t3lib_db->escapeStrForLike() is using preg_replace, which is not necessary
Jigal van Hemert
jigal at xs4all.nl
Sun Sep 5 09:55:52 CEST 2010
Hi,
On 5-9-2010 0:43, Marcus Krause wrote:
> Here's some output from a test script with a bunch of iterations:
>
> Before: foo_bar%
> After: foo\_bar\% (preg_replace)| Parsetime: 0.302683115005 | 100%
> After: foo\_bar\% (str_replace) | Parsetime: 0.298494100571 | 99%
> After: foo\_bar\% (addcslashes) | Parsetime: 0.0949509143829 | 31%
>
>
> I guess we should use addcslashes, a specialized function for that use
> case. ;-)
Good catch!
Maybe patches with cleanups, speed "improvements", simplifications, etc.
should have a benchmark test attached (besides a unit test) ?
@Marcus: can you attach the benchmark script so others can easily test
it on various machines?
From the data provided by Marcus the original patch cannot be seen as a
"performance" enhancement, so I'm tempted to give a -1 (why change code
when it doesn't really change anything?). Unless addcslashes() will be
used and some benchmark results prove real speed improvements.
--
Kind regards / met vriendelijke groet,
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh
More information about the TYPO3-team-core
mailing list