Skip to content

perf: defer settings writes off the keystroke hot path + document the rules - #4

Merged
hellno merged 1 commit into
mainfrom
hellno/linear-performance-breakdown
Jun 7, 2026
Merged

perf: defer settings writes off the keystroke hot path + document the rules#4
hellno merged 1 commit into
mainfrom
hellno/linear-performance-breakdown

Conversation

@hellno

@hellno hellno commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Deck wrote the entire Settings JSON to disk synchronously on every keystroke in the display-name field — the one spot it inverted Linear's "apply to memory now, persist off the hot path" rule. This makes Settings::save() return an io::Result (no more silent let _ = drops) behind a save_best_effort() UI helper, and persists the name input on Blur instead of on every InputEvent::Change, so the render thread never blocks on I/O. It also adds a docs/LEARNINGS.md §17 deep-dive — "Performance: Linear-esque snappiness, the native way" (most of Linear's tricks are web-platform tax a native GPUI binary skips; the few rules that carry over) — plus a lockstep "Performance — keep the UI thread sacred" section in CLAUDE.md / AGENTS.md so future contributors and forkers follow the same discipline. No new dependencies, and just ci is green (fmt + clippy on both feature configs + tests).

… rule

Deck inverted Linear's "apply to memory now, persist off the hot path" pillar in
one spot: the display-name field wrote the whole Settings JSON to disk
synchronously on every keystroke. Now it mirrors the value into memory on change
and persists only on blur, so the render thread never blocks on I/O.

- settings: `save()` returns `io::Result` (no more silent `let _ =` drops); add
  `save_best_effort()` as the UI entry point (logs and moves on — a lost
  preference must never crash or stall the UI). All call sites updated.
- shell: persist the name input on `Blur`, not on every `InputEvent::Change`.
- docs: new LEARNINGS §17 "Performance — Linear-esque snappiness, the native way"
  (most of Linear's tricks are web tax a native binary skips; the few rules that
  carry over), plus a lockstep "Performance — keep the UI thread sacred" section
  in CLAUDE.md / AGENTS.md.

No new deps. just ci green (fmt + clippy on both feature configs + tests).
@hellno
hellno merged commit 71c9eff into main Jun 7, 2026
3 checks passed
@hellno
hellno deleted the hellno/linear-performance-breakdown branch June 11, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant