[TYPO3-core] RFC #15002: Enhancement of t3lib_div::isFirstPartOfStr

Michiel Roos [netcreators] michiel at netcreators.com
Tue Jul 6 23:16:30 CEST 2010


On 7/6/10 10:31 AM, Steffen Kamper wrote:
> Jigal van Hemert schrieb:
>> The TYPO3 API says both parameters must be a string, so it should not
>> accept an integer IMO.

Ok, we can cast the input to a string at the cost of performance. But I
really don't want to go in that direction.

> think of these calls:
> isFirstPartOfStr(NULL, 'a')
> isFirstPartOfStr('string', NULL)
> isFirstPartOfStr(array(a,b),'xyz')

We must focus on improving the performance of the function in 'normal
use cases':
- str and partStr both strings
- str is a string and partStr is an empty string
- str is an empty string and partStr is a string

Performance for these cases may not get worse after changing the function.

I am trying to improve the speed of this function, not enhancing it in
any other way. This function has been there as it is now since revision
20 (initial import of TYPO3).

I rewrote the test case please find it attached and run the tests.

I find that variant3 performs best for 'normal use'. Choosing that
variant will bring a speed improvement while keeping the same
functionality as the function has always had.

-- 
Met vriendelijke groet / Warm regards,

Michiel Roos
Chief Technical Officer
Netcreators: Open Source, Open Minds, Open People
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 15002_test_v6.php
Type: text/php
Size: 2886 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100706/e3e2ced4/attachment.bin>


More information about the TYPO3-team-core mailing list