[fpc-devel] Patch to speed up Uppercase/Lowercase functions
Michael Van Canneyt
michael at freepascal.org
Sat Jun 11 15:48:37 CEST 2005
On Sat, 11 Jun 2005, Joost van der Sluis wrote:
> If we're gonna hold a discussion like this for every optimilisation, it
> isn't worth the effort imho. But now we're busy with it:
>
> > Well. Discussion is nice, but what does the real world show ?
>
> > To compare, I made 6 versions of Lowercase:
> > 1 - Sysutils
> > 2 - Sysutils with Joost's improvement.
> > 3 - Sysutils with Joost's improvement, but forward loop.
> > 4 - Using PChar.
> > 5 - Using PChar with lookup table and if check
> > 5 - Using Pchar with lookup table and no check.
>
> You shoudn't use the sysutils's version. It's better to copy the source
> from sysutils to the testprogram.
>
> I've added that (lowercase1) and i've added Daniel's asm-procedure...
Timing for Daniel's procedure doesn't count, it's shortstrings.
They are limited to 256 characters, obviously this will execute faster;
The ansistring S used is 2400 characters (so a factor 10 longer).
>
> > Result on an AMD 64 3000:
> > Lowercase time to execute: 00:00:01.563
> > Lowercase2 Time to execute: 00:00:01.363
> > Lowercase3 Time to execute: 00:00:01.394
> > Lowercase4 Time to execute: 00:00:00.999
> > Lowercase5 Time to execute: 00:00:01.021
> > Lowercase6 Time to execute: 00:00:00.948
>
> > So, judge for yourself. I think this is worth the 256 byte lookup table.
>
> Further I've used the more precise timer-utils from Tom. Most remarkably
> is that now my lowercase is actually _slower_ then the one in the RTL.
> Yesterday and in Michael's test it's the other way around?
Depends on the used optimizations, I suppose.
Michael.
More information about the fpc-devel
mailing list