mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-31 04:39:01 +00:00
terminal: avoid copying set lookup items
Keep the resident RefCountedSet item behind a pointer while probing. The previous value copy materialized the complete generic item before checking its metadata and equality, which is especially costly for terminal styles. ReleaseFast timings are seven-run median user CPU times. | Workload | Before | After | Change | | --- | ---: | ---: | ---: | | 128 styles, live lookup | 0.80s | 0.74s | -7.5% | | 4,096 styles, live lookup | 0.92s | 0.87s | -5.4% | | Alternating SGR stream | 1.21s | 1.20s | -0.8% |
This commit is contained in:
@@ -560,7 +560,7 @@ pub fn RefCountedSet(
|
||||
return null;
|
||||
}
|
||||
|
||||
const item = items[id];
|
||||
const item = &items[id];
|
||||
|
||||
// An item with a shorter probe sequence length would never
|
||||
// end up in the middle of another sequence, since it would
|
||||
|
||||
Reference in New Issue
Block a user