D hash table comparison benchmark

Nathan S. no.public.email at example.com
Tue Jun 26 15:14:41 UTC 2018


On Tuesday, 26 June 2018 at 14:33:25 UTC, Eugene Wissner wrote:
> Tanya hashes any value, also integral types; other hashtables 
> probably not.

Your intuition is correct here. Most of the tables use 
`typeid(key).getHash(&key)`, which for `int` just returns `key`.

= Built-in AA =
General case: `typeid.getHash` with additional scrambling.
Customizable: no.

=memutils.hashmap=
General case: `typeid.getHash`.
Customizable: no.
Other notes:
* Special case for `toHash` member (bypasses `typeid`).
* Interesting special cases for ref-counted data types, with 
further special cases for ref-counted strings and arrays.

=vibe.utils.hashmap=
General case: `typeid.getHash`.
Customizable: yes, through optional `Traits` template parameter.
Other notes:
* Special case for `toHash` member (bypasses `typeid`).
* Tries to implement a special case for objects with the default 
`Object.toHash` function, but it seems like it can never work.

=jive.map=
General case: `typeid.getHash`.
Customizable: no.

=containers.hashmap=
General case: `typeid.getHash`.
Customizable: yes, through optional `hashFunction` template 
parameter.
Other notes:
* Special case for strings on 64-bit builds. Uses FNV-1a instead 
of default hash function.


More information about the Digitalmars-d mailing list