[fpc-devel] Alternative parsers

Marco van de Voort marcov at stack.nl
Tue Oct 19 21:02:21 CEST 2010


In our previous episode, Sergei Gorelkin said:
> > 
> > Average string length 45 characters:
> > ShortString: 12.0 s
> > AnsiString: 3.2 s
> > 
> > I agree that the first case is more relevant for the compiler,
> > but still you can see that ShortStrings are clearly not always faster.
> > 
> I believe it's not ShortStrings per se to blame, but storing them in a large single memory block as 
> it is being done in TFPHashList. Adding a lot of keys will cause many reallocations. Large size of 
> the block forces memory manager to use variable-size pool, which is less efficient than using 
> fixed-size blocks in case of small chunks.

I actually thought that too, and did a benchmark (cclasses')hashlist against an own
implementation based on array of array (to reduce that by a magnitude) a few
years back

Mine was slower. 



More information about the fpc-devel mailing list