[fpc-devel] Alternative parsers
Adem
listmember at letterboxes.org
Tue Oct 19 19:09:07 CEST 2010
On 2010-10-19 19:38, Alexander Klenin wrote:
> On Wed, Oct 20, 2010 at 01:45, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> If you need more convincing: the contnrs unit contains 2 hash classes.
>> one based on ansistrings, one with pchars and shortstrings. The pchar
>> version is easily 20% faster. It comes from the compiler code and was
>> written specially by Peter Vreman.
>>
>> Try and improve that class with ansistrings. If you succeed, only then we
>> can start making a case for using them in the compiler.
> Ok, I went ahead and have taken look at the code.
> I assume you speak about TFPHashList vs TFPCustomHashTable.
> The classes are not really comparable, because they use quite
> different internal data structures.
> So instead I converted TFPHashList list to use ansistrings.
>
> Benchmarking included 3*10^6 calls to Add and Find methods
> with the arguments of various lengths.
>
> Average string length 5 characters:
> ShortString: 1.15 s
> AnsiString: 1.56 s
>
> 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
Just curious: Would you, by any chance, have a figure for this:
In a (self) compile operation, how many times are either of these these
routines called?
--
Cheers,
Adem
More information about the fpc-devel
mailing list