From e6a62c4bb0df7e3d0d3b964237fe111073a748ea Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 3 Feb 2026 12:19:20 +0000 Subject: [PATCH] Minor optimization to `map_probe_distance` --- base/runtime/dynamic_map_internal.odin | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/runtime/dynamic_map_internal.odin b/base/runtime/dynamic_map_internal.odin index 298b586f5..73a152845 100644 --- a/base/runtime/dynamic_map_internal.odin +++ b/base/runtime/dynamic_map_internal.odin @@ -283,7 +283,9 @@ map_desired_position :: #force_inline proc "contextless" (m: Raw_Map, hash: Map_ map_probe_distance :: #force_inline proc "contextless" (m: Raw_Map, hash: Map_Hash, slot: uintptr) -> uintptr { // We do not use map_cap since we know the capacity will not be zero here. capacity := uintptr(1) << map_log2_cap(m) - return (slot + capacity - map_desired_position(m, hash)) & (capacity - 1) + + // return (slot + capacity - map_desired_position(m, hash)) & (capacity - 1) + return (slot - uintptr(hash)) & (capacity - 1) // NOTE(bill): this is equivalent to the above, but less operations } // When working with the type-erased structure at runtime we need information