[fpc-devel] TViHashList and TFPHashObjectList in compiler
Michael Van Canneyt
michael at freepascal.org
Tue Sep 22 17:54:11 CEST 2026
On Tue, 22 Sep 2026, Juha Manninen via fpc-devel wrote:
> runewalsh via fpc-devel kirjoitti 21.9.2026 klo 16.20:
>> I made it in
>> https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/132.
>>
>> It’s a synthesis of the old TFPHashList (from which it inherited O(N)
>> removals), and my private bleeding-edge hash table based on the Python
>> 3.6+ dict:
>>
> https://github.com/zpoint/CPython-Internals/blob/master/BasicObject/dict/dict.md.
>
> Thanks for the information!
>
> I understood it reduces memory consumption a lot which should also
> improve speed indirectly in most computers (less memory traffic). Then
> if AnsiStrings are used for symbol, it slows down the compilation
> because of try..finally blocks. Is it so?
>
>
>> Such things are not something you should worry about, and they don’t
>> concern the compiler’s logic — treat it as a black box.
>
> No, I want to understand everything. :)
>
> I got obsessed with the perfect hash thing for quickly finding language
> tokens and directives. I didn't figure out the gperf usage so I made
> some code of my own. I may experiment with the compiler code. Let's see.
I did some real tests.
The speedup by using gperf-generated code is simply negligable.
Michael.
More information about the fpc-devel
mailing list