[fpc-devel] Who maintains TDictionary? // Re: RFC: Improvements for TDictionary and other hash containers
Martin Frb
lazarus at mfriebe.de
Tue Apr 15 14:16:23 CEST 2025
Quick question
When re-using known hash in rehash
https://gitlab.com/martin_frb/fpc-src/-/commit/9b398efb33897b3b5e98678033ddaafd1bcea883
Rehash is (mostly?) used for resize.
But an inherited class could change the hash algorithm and call it.
So there need to be a way to force new hashes.
1) Split into rehash and resize
Contra: Code duplication
2) New param
AForceHashCalculation: Boolean = True
Default to current behaviour.
2) Use existing "AForce"
Slight change of existing code calling it with AForce=False, but new
size, and new hash algorithm.
AForce is currently set to true by
procedure
TOpenAddressingTombstones<OPEN_ADDRESSING_CONSTRAINTS>.ClearTombstones;
-----------
2nd question
Most subclasses use the same code in FindBucketIndex(AItems....)
1) Move to TOpenAddressing
Contra: extra code for subclasses not using it
Contra: if new subclasses do not override either FindBucketIndex or
FindBucketIndexForHash then it creates a circle.
(Old subclasses must have it already overriden
2) New subclass inbetween TOpenAddressingSingleHash ? Name?
3) Leave as in the commit?
Contra: Duplicate code
More information about the fpc-devel
mailing list