ideas for ghashmap
Original Reporter info from Mantis: BeniBela @benibela
-
Reporter name: Benito van der Zander
Original Reporter info from Mantis: BeniBela @benibela
- Reporter name: Benito van der Zander
Description:
The ghashmap is extremely slow (e.g. compared to TFPDataHashTable from contnrs).
Here are some ideas to improve it:
* make the key const
* For large keys (e.g. strings), drop the second arg of hash, so it does not generate a hash from <0,n-1> but from <0,maxuint-1> and cache that hash in the map. Currently it is comparing full keys even if the full hash codes of those keys would be different, because it only gets the truncated hash codes.
Although for keys smaller than the hash that would not matter, it needs to adjust depending on the size.
* Drop TVector. The additional cache-miss from the indirection to the table array and in each container to the container array can hurt a lot. An array of arrays, or even an array of pointer blocks will be faster.
* Actually consider dropping the containers altogether. Open hashing is usually faster, despite the deletion complications. https://infosys.cs.uni-saarland.de/publications/p249-richter.pdf
Mantis conversion info:
- Mantis ID: 30664
- Version: 3.1.1