grid: re-interning the pen on every SGR costs 21% of the parse thread under DOOM-fire #416
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#416
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Split from #399.
Under DOOM-fire the parse thread spends about a fifth of its time re-interning the pen. Linux profile of the daemon (i5-12400F, felis
mainef96bb46, release with line tables,perf record -e cycles:u --call-graph lbr, 15 s of DOOM-fire at 188x93, load 5.2), share offelis-pty-parsersamples:Grid::resync_pen_style(crates/felis-grid/src/lib.rs)StyleTable::intern(crates/felis-grid/src/style_table.rs)hash_one<Attributes>Attributes::equivalentAttributes::apply_sgrEvery SGR ends in
resync_pen_style, which looks the wholeAttributesup in the dedup map (hash plus equality) even when the pen matches the previous one. DOOM-fire sends a38;5/48;5pair per cell.Candidate levers, neither measured yet:
apply_sgr).(Attributes, StyleId)pairs in front of the dedup map, the lever.agents/skills/perf-trace/references/cost-maps.md"ascii cell-write path" already names for truecolor floods. A single last-hit entry does not help there: consecutive truecolor pens differ.Either one has to stay correct across
StyleTable::compact, which renumbers ids: a cached id from before a compaction points at the wrong pen afterwards.Done when the parse thread's share in
resync_pen_styleunder DOOM-fire drops by a measured amount, with the doom and truecolor floor benches (measure_parse_into_grid_floor) not slower, or the profile shows the lookup cannot get cheaper and the reason is recorded.