[dokuwiki] Re: utf8 functions could be faster

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 10 Jul 2011 12:32:26 +0200

another one of these loose ends...

On Tue, Apr 5, 2011 at 6:51 AM, TNHarris <telliamed@xxxxxxxxxxx> wrote:
> On 03/14/2011 08:54 PM, TNHarris wrote:
>>
>> I measured utf8_stripspecials with English, German, and Japanese
>> strings. (See attachment.) String lengths were:
>> English: 14, 83, 167, 507, 69969
>> German: 16, 83, 170, 529, 69877
>> Japanese: 15, 88, 168, 533, 72266
>>
>> old en: 0.17372, 0.82951, 1.71201, 5.29036, 530.94489
>> old de: 0.19019, 0.83116, 1.69232, 5.28697, 528.94762
>> old ja: 0.07924, 0.31162, 0.67059, 3.54457, 305.57479
>> new en: 0.33082, 0.46088, 0.61384, 0.82114, 89.03135
>> new de: 0.33938, 0.44337, 0.54182, 0.79181, 85.15497
>> new ja: 0.33939, 0.40425, 0.50494, 0.68881, 49.70783
>>
>> It may be worth putting in a length test to use the faster function when
>> the string is short. I should also try it using strtr.
>
> I couldn't think of a better way to improve this. The crossing point seems
> to be between 24 and 32 characters.


Could simply check the input length and switch to the faster
implementation based on that?

Tom can you open a pull request?

Chris, can you please have a look at this again and merge it unless
something speaks against it?

Andi

-- 
splitbrain.org
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: