| ... | @@ -1187,17 +1187,13 @@ pub fn HashMapUnmanaged( | ... | @@ -1187,17 +1187,13 @@ pub fn HashMapUnmanaged( |
| 1187 | } | 1187 | } |
| 1188 | | 1188 | |
| 1189 | /// Find the index containing the data for the given key. | 1189 | /// Find the index containing the data for the given key. |
| 1190 | /// Whether this function returns null is almost always | 1190 | fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize { |
| 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 { | | |
| 1198 | comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash, false); | 1191 | comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash, false); |
| 1199 | | 1192 | |
| 1200 | if (self.size == 0) { | 1193 | 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); |
| 1201 | return null; | 1197 | return null; |
| 1202 | } | 1198 | } |
| 1203 | | 1199 | |