terminal: advance set lookup buckets directly

Carry the current RefCountedSet bucket through the probe loop instead of
recomputing hash plus probe length and narrowing it on every iteration.
The bucket remains in the set ID type and wraps with the existing table mask.

ReleaseFast timings are seven-run median user CPU times.

| Workload | Before | After | Change |
| --- | ---: | ---: | ---: |
| 128 styles, live lookup | 0.71s | 0.70s | -1.4% |
| 4,096 styles, live lookup | 0.89s | 0.85s | -4.5% |
| Alternating SGR stream | 1.11s | 1.11s | unchanged |
This commit is contained in:
Mitchell Hashimoto
2026-07-11 19:56:34 -07:00
parent 62cc056ae3
commit 49cfb347b5

View File

@@ -593,8 +593,9 @@ pub fn RefCountedSet(
const table = self.table.ptr(base);
const items = self.items.ptr(base);
var p: Id = @truncate(hash);
p &= self.layout.table_mask;
for (0..self.max_psl + 1) |i| {
const p: usize = @intCast((hash +% i) & self.layout.table_mask);
const id = table[p];
// Empty bucket, our item cannot have probed to
@@ -624,6 +625,8 @@ pub fn RefCountedSet(
{
return id;
}
p = (p +% 1) & self.layout.table_mask;
}
return null;