[fpc-devel] Patch to speed up Uppercase/Lowercase functions
david at e.co.za
Sun Jun 12 11:22:08 CEST 2005
On Sat, 11 Jun 2005 18:36:44 +0200 (CEST), you wrote:
>> The most expensive operation in the whole LowerCase function is the
>> UniqueString allocation for when the string changes. For the case
>> where the string is already in lower case it is important not call
>> UniqueString. It makes a 600% difference is speed on Delphi for my
>> test case (haven't tested on fpc yet).
>> This is why it is important to have this line in Lowercase2 for
>> if (result[i] in ['A'..'Z']) then
>> It prevents the UniqueString call if nothing changes.
>That is why I use pchar and one uniquestring;
>It prevents all these automated uniquestring calls.
Why call it when it might not be necessary??
My point is that you can make the function MUCH faster for the case
where the function doesn't modify the string by not calling
UniqueString at all.
More information about the fpc-devel