[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 21:38:12 CEST 2010


Hi,

On 5-9-2010 15:21, Marcus Krause wrote:
>> On 5-9-2010 0:43, Marcus Krause wrote:
>>> Here's some output from a test script with a bunch of iterations:
>>> [...]

On my Vista laptop:

Before:  foo\_bar\%
After:   foo\\_bar\\% (preg_replace)  | Parsetime: 0.907906 | 100%
After:   foo\\_bar\\% (str_replace)   | Parsetime: 0.606525 | 66%
After:   foo\\_bar\\% (addcslashes)   | Parsetime: 0.404978 | 44%

On a CentOS server:

Before:  foo\_bar\%
After:   foo\\_bar\\% (preg_replace)  | Parsetime: 0.298701 | 100%
After:   foo\\_bar\\% (str_replace)   | Parsetime: 0.343246 | 114%
After:   foo\\_bar\\% (addcslashes)   | Parsetime: 0.107410 | 35%

This second measurement (repeated multiple times) shows that seemingly 
"complex" functions are not necessarily slower!

Anyway, for a version with addcslashes I will vote with a +1.

I propose that we document somewhere that "performance" RFCs must 
include a benchmark script.

-- 
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