Skip to content

Hoist frame-constant fonts and shaW out of the per-row draw loop #87

Description

@zangjiucheng

The per-visible-row loop in renderContent does five ctx.font assignments (main.ts:594, 636, 640, 646, 654) and at least three measureText calls per row. Almost all of it is constant for the whole frame.

Scope — the deterministic parts only

  • Hoist the three zoom-derived font strings above the loop at main.ts:560
  • Delete the :654 re-assignment by reordering the sha and author draws. Its own comment at :650-653 admits it only exists because :646 clobbered the font
  • Hoist shaW: 7 characters is enforced, not merely documented (commands.rs:393, main.ts:636), so it never needs re-measuring

Deliberately out of scope

A content memo was considered and is not part of this. If anyone adds one later it must be keyed on text content, not (row, maxw, font)BACKEND.rows is mutated in place at :3223 and :3248 without changing the graph object's identity, so an identity-keyed memo would serve stale text.

Measurement

Existing DEV HUD millisecond counter, before and after, on a ref-dense repository. No HUD delta, no merge.

Good first issue

Mechanical, local to one function, and the correctness bar is simply "the canvas still looks identical."


Found during v1.3.0 research: parallel codebase surveys, then each finding independently verified against the code before filing. Line numbers are from dev at the time of writing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersperformanceSpeed, memory, or startup costv1.3.0Targeted for the 1.3.0 release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions