perf: defer settings writes off the keystroke hot path + document the rules - #4
Merged
Merged
Conversation
… 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deck wrote the entire
SettingsJSON 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 makesSettings::save()return anio::Result(no more silentlet _ =drops) behind asave_best_effort()UI helper, and persists the name input onBlurinstead of on everyInputEvent::Change, so the render thread never blocks on I/O. It also adds adocs/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 inCLAUDE.md/AGENTS.mdso future contributors and forkers follow the same discipline. No new dependencies, andjust ciis green (fmt + clippy on both feature configs + tests).