Hashtable: use dynamic growth and use primes as size

Dynamically increase the hashmap size to not exceed the load factor and
avoid too long chains.

Switch from Separate Chaining to Robin Hood linear probing to improve
cache locality.

Use primes as size to further avoid collisions.

E.g. on a standard kde system the number of entries in the ProcessTable
might be around 650.
This commit is contained in:
Christian Göttsche
2020-10-22 15:43:26 +02:00
committed by BenBE
parent 7914ec201e
commit 307c34b028
3 changed files with 210 additions and 74 deletions

View File

@ -20,7 +20,7 @@ in the source distribution for its full text.
UsersTable* UsersTable_new() {
UsersTable* this;
this = xMalloc(sizeof(UsersTable));
this->users = Hashtable_new(20, true);
this->users = Hashtable_new(10, true);
return this;
}