[fpc-devel] Patch to speed up Uppercase/Lowercase functions

Florian Klaempfl florian at freepascal.org
Sat Jun 11 00:19:24 CEST 2005


Joost van der Sluis wrote:

>>>I don't know if rtl-optimilisation patches have a large priority, but
>>>nevertheless this patch improves the speed of the sysutils.uppercase and
>>>lowercase functions.
>>
>>I fail to see how changing a while loop to a for loop improves speed ?
>>I could understand if you'd use a PChar and use pointer math, but not this ?
> 
> 
> I wasn't completely sure, so i made a test-prog which called the function
> 50.000 times, and measured the time it took to run a few times. 
> 
> And then again with the other version. (approx 2.5 sec against 1.4)
> 
> And I think it's because the removal of the begin/end. 

begin/end doesn't change any code.

> And Peter always
> says that you can't change the running variable in a for-loop because of
> the optimilisations... So i suppose that a for-loop has several
> optimilisations which a while doesn't...

Yes.

Can you test also with a forward loop?





More information about the fpc-devel mailing list