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

Daniël Mantione daniel at deadlock.et.tudelft.nl
Sun Jun 12 12:28:37 CEST 2005



Op Sun, 12 Jun 2005, schreef Uberto Barbini:

> > >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.
>
> If I understood well, with modern processor an unpredicatable branch (i.e. one
> with similar probability) is much more time-consuming that an unnecessary
> function call.

Yes, but the call needs to do memory allocation and a string copy, so it
is not just the call.

> ps. is there a way to see the assembly producted by a FPC function?

Sure. Depending on your prefered asm style:

fpc -Anasmelf -a -s filename.pas
fpc -Agas -a -s filename.pas

Daniël





More information about the fpc-devel mailing list