render: hash the glyph cache keys with foldhash #397
No reviewers
Labels
No labels
priority/P0
priority/P1
priority/P2
release/v0.1.0
status/blocked
status/planned
type/bug
type/design
type/test-gap
type/tracker
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/felis!397
Loading…
Reference in a new issue
No description provided.
Delete branch "render/glyph-foldhash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The client's glyph cache hashed its per-cell keys with std's SipHash. On every frame the renderer walks each cell and looks it up in the
primedset and theslotsmap. A DOOM-fire profile put that hashing at about 14% of the client main thread's samples.Both containers now use
foldhash::fast::RandomState. The keys come from PTY output: the grid's chars and OSC 66 sizing. The seed is therefore random per process, not theFixedStatethat felis-grid's intern tables use. Those tables tolerate a fixed seed because the style sweep bounds them.slotsis not bounded: a glyph that rasterizes blank is cached without using atlas space, so it never triggers the reset that clears the map. With a fixed seed, a producer could precompute keys that share a bucket. The blank ones among them would pile up until something else fills the atlas and resets it. The random seed measured no slower thanFixedState, so nothing is traded for it. The unbounded growth itself is #406.Measured on an M4 Max: release build, default config, three alternating runs against main, 10 s of DOOM-fire each.
The daemon code is identical in both builds, yet its CPU time was about 2% higher in every run with this PR. The cause is unverified. One possibility is that a cheaper client answers more of the daemon's frames; the frame rate did not change.
cargo nextest run -p felis-render-wgpu: 267/267 pass.cargo clippy -p felis-render-wgpu --all-targets -D warnings: clean.9f9f9d5c9cc9762f90bec9762f90be1f9eb8cf791f9eb8cf7963ccb930c763ccb930c7450344a59f450344a59f990c95947f