[fpc-devel] Alternative parsers

Sergei Gorelkin sergei_gorelkin at mail.ru
Tue Oct 19 20:57:51 CEST 2010


Michael Van Canneyt пишет:
> 
>> 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.
> 
> Strange. The whole idea of the implementation was to improve memory 
> efficiency.
> And at the time, it was definitely and consistently faster.
> If Alexander sends me his code, I will check, and then I should ask 
> Peter Vreman, who wrote the code. (if he'll still answer).
> 
It is indeed very efficient regarding number of bytes occupied. Storing all strings in one block has 
no storage overhead at all.
Stressing this implementation with huge amount of Add's won't show the best speed, but it has little 
common with the intended usage scenario, which is "single Add, multiple Find's". Also in the 
compiler, the average number of items in a single TFPHashList is not huge. It can grow huge in units 
like Windows (many procedures in one namespace), but these are more like extreme cases.

Regards,
Sergei



More information about the fpc-devel mailing list