[TYPO3-core] RFC #10511: simplify and speed up t3lib_div::trimExplode()

Steffen Kamper info at sk-typo3.de
Sat Feb 21 20:20:57 CET 2009


Hi Ingo,

Ingo Renner schrieb:
> 
> ok too bad, but I had to create a third version after noticing that the 
> thing with create_function() is quite slow - slower than the foreach 
> loop we had before.
> Thus I returned to the foreach loop for the case that we remove empty 
> elements.
> 
> speed improvements with this version:
> 10-25% when removing empty elements
> 25-40% when keeping empty elements
> 
> There will be another little boost when fixing the behavior of $limit, 
> but that's a different issue.
> 
> 
> best
> Ingo
> 

why not fix the limit with it? It's a small change.

Please look to attached patch that solves
1) right trimming (doesn't work with removeEmptyValues + limit)
2) limit now works in combination with removeEmptyValues

for test i used the above mentioned string where you can test it easy.
$a = 's ,, d  ' . chr(10) . chr(9).', d,eee';

vg Steffen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: simpler_faster_trimExplode_v4.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090221/bf34b9cd/attachment.txt 


More information about the TYPO3-team-core mailing list