[fpc-devel] TViHashList and TFPHashObjectList in compiler

Juha Manninen juha.manninen62 at gmail.com
Sat Sep 19 10:44:08 CEST 2026


I studied the compiler internals by debugging it.

Does TViHashList have any documentation or diagram or anything? It 
differs from many other hash maps. Is it based on some other code which 
is documented?

TFPHashObjectList is based on it. It is used for all symbols but also 
for predefined directives. How about setting its capacity initially in 
such cases, like:

      procedure InitScanner;
        begin
          turbo_scannerdirectives:=TFPHashObjectList.Create;
+        turbo_scannerdirectives.Capacity:=150;

Less GetMem() calls, copying data and recalculating hashes.

For predefined directives and tokens a "perfect hash" would be perfect. 
:)  I mentioned it in this MR

https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/126


Juha




More information about the fpc-devel mailing list