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

Joost van der Sluis joost at cnoc.nl
Sat Jun 11 00:02:40 CEST 2005


> > 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. 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...

Joost.







More information about the fpc-devel mailing list