mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-31 04:39:01 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user