Repository navigation
perf(desktop): stop 30s wake_after echo chamber and idle poll churn - #1692
Merged
Merged
Conversation
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.
Summary
perf.logtelemetry on Massive memory usage. #1649 (~1.3–5.1 MB/s of continuous UI-thread allocation traffic, 6.6–7.5 GB over 1–1.5 h while minimized/idle) caused by polling systems unconditionally re-pushingtx.wake_after/tx.wake_atdeadlines on everypoll().apps/desktop/src/surfaces/automations/{mod,source}.rs:tx.wake_after(30s)with an explicitPollWakestate machine (Idle | Armed { due }) that arms at most one wake for the earliest server that will actually become due next (and arms nothing when all servers areUnsupportedor have no automations).changed = trueon unchangedBgResult::List/Commandresponses (eliminating spurious 30 s redraws while visible) and usesinbox_wakeso quiet results skip frame presents.entries/filtered_entries,tab_dirs, andget_mut(&AUTOMATIONS)so idle polls avoid unnecessary allocations andTrackedinvalidations.apps/desktop/src/shell/memory_reclaim.rs:MemorySweep::Scheduledto Rune's monotonic clock (due: f64) so the 30 s wake is scheduled once on transition/reschedule instead of re-pushing a sub-ms-driftedwake_afteron every poll, and avoids bumpingTracked&SWEEPwhen state is unchanged.apps/desktop/src/session/inbox/model.rs:TickWake(Cell<TickWake>) so the 1 s / 60 s age-tick wake is armed once per boundary instead of on every poll.apps/desktop/src/workspace/servers/health.rs&apps/desktop/src/kernel.rs:HealthWake(HEALTH_WAKEslot) so the 10 s health deadline is armed once per due timestamp instead of on every poll.apps/desktop/src/surfaces/browser/rpc/{hold,mod}.rs:RpcWakeso RPC deadlines arm once per dueInstant, readsworker_rxuntracked, and skips thestd::mem::take/get_mutround-trip when no sessions or holds are active.Verification
pwsh scripts/guardrails.ps1(10/10 passed),cargo check -p opencode-desktop --lib --bins, andcargo clippy -p opencode-desktop --lib --bins --no-deps(zero warnings on touched code).Related to #1649 (leaving #1649 open for live verification of overall Task Manager memory usage once this ships).