perf(ds): replace MD5 key hash in hashmap with FNV-1a32
continuous-integration/drone/push Build is passing

Removes per-lookup heap allocation (MD5Buffer/kfree) in favour of a
single zero-allocation FNV-1a32 pass. Drops core.enc.md5 dependency
from core.ds.hashmap.
This commit is contained in:
2026-03-08 13:59:56 +00:00
parent 2159578bdf
commit f2e5f3535a
+2 -13
View File
@@ -23,7 +23,7 @@ interface
uses
memory.heap,
core.enc.md5,
core.enc.fnv1a,
core.strings,
io.syslog,
debug.tracer,
@@ -64,19 +64,8 @@ procedure forEach(map : PHashMap; cb : THashForEachCb; ud : void);
implementation
function KeyHash(key : pchar) : uint32;
var
KeyLength : uint32;
MD5_Hash : PMD5Digest;
Hash128 : puint128;
Hash32 : uint32;
begin
KeyLength:= StringSize(key);
MD5_Hash:= MD5Buffer(puint8(key), KeyLength);
Hash128:= puint128(MD5_Hash);
Hash32:= MD5To32(Hash128);
KeyHash:= Hash32;
kfree(void(MD5_Hash));
KeyHash := Hash_FNV1a32(void(uint32(key)), StringSize(key));
end;
function hashIndex(size : uint32; hash : uint32) : uint32;