From 307c34b028d353154aa268eceb38e0331c8275cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 22 Oct 2020 15:43:26 +0200 Subject: 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. --- UsersTable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'UsersTable.c') diff --git a/UsersTable.c b/UsersTable.c index 25e44883..fdbfd68f 100644 --- a/UsersTable.c +++ b/UsersTable.c @@ -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; } -- cgit v1.2.3