authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-12-15 03:41:56-08:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-12-15 17:20:08-08:00
log0fe17ea12a5bc389d8cb0c87027a112a552e9cbc
treebe3c154f5ef9308af3e0f4d28d305a1f2982091e
parentb58916bb7ca2ef4087107c630ed5118d1bf91dea
signaturelock-open Commit is signed but in an unrecognized format.

hashmap: remove `inline` from `getIndex` now that we have `@branchHint`


1 files changed, 4 insertions(+), 8 deletions(-)

lib/std/hash_map.zig+4-8
......@@ -1187,17 +1187,13 @@ pub fn HashMapUnmanaged(
11871187 }
11881188
11891189 /// Find the index containing the data for the given key.
1190 /// Whether this function returns null is almost always
1191 /// branched on after this function returns, and this function
1192 /// returns null/not null from separate code paths. We
1193 /// want the optimizer to remove that branch and instead directly
1194 /// fuse the basic blocks after the branch to the basic blocks
1195 /// from this function. To encourage that, this function is
1196 /// marked as inline.
1197 inline fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize {
1190 fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize {
11981191 comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash, false);
11991192
12001193 if (self.size == 0) {
1194 // We use cold instead of unlikely to force a jump to this case,
1195 // no matter the weight of the opposing side.
1196 @branchHint(.cold);
12011197 return null;
12021198 }
12031199