Skip to content

1.48.0: lighter at rest — scan, probe, git and the background listing only when they can matter - #69

Closed
writingdeveloper wants to merge 1 commit into
mainfrom
perf/idle-cost
Closed

writingdeveloper wants to merge 1 commit into
mainfrom
perf/idle-cost

Conversation

@writingdeveloper

Copy link
Copy Markdown
Owner

Why

Measured on Windows 11 with two sessions open and nothing happening (1.47.0, 15 minutes): ~5% of one core (main 1.7%, renderer 2.3%, GPU 1%), ~590 MB working set. Most of the CPU was periodic work re-reading what the window already showed:

every work cost
1 s screen-tail scan of every live terminal buffer walk per tile
30 s agent probe per tile → Get-CimInstance Win32_Process PowerShell process, ~500 ms, ~80 MB
30 s git rev-parse + git status per tile (+ worktree) 2+ processes per tile
30 s claude agents --json --all, here and on each connected PC Claude Code process, ~340 ms

What changes

  • Screen scan only after the terminal was written to (output, replayed screen, repaint — screenDirtyAt, which unlike lastDataAt is never withheld), plus a 2 s settle for xterm's deferred parse.
  • Agent probe only for a tile that printed since its last probe (providerCheckAt). Select and the update restart (refreshLiveSessionIds) still probe outright.
  • Git: selected tile every tick, others every fourth tick (2 min), none while the window is hidden. Select still refreshes at once.
  • Background listing: 30 s focused with rows · 60 s when the group is empty everywhere · 120 s unfocused.

The rules are pure functions in src/shared/idleCadence.ts with tests; cockpitView.ts only calls them. Nothing shown changes.

At rest with two sessions: scheduled process starts drop from ~9/min to ~1/min; the per-second scans go to zero.

Release notes: docs/releases/1.48.0.md (also lists what was looked at and left alone).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX

… only when they can matter

Measured on Windows with two idle sessions (1.47.0, 15 min): ~5% of a core,
mostly periodic work re-reading what the window already showed.

- The activity tick reads a terminal's screen tail only after the terminal
  was written to (output, a replayed screen, a repaint), and for two more
  seconds while xterm catches up; a quiet terminal keeps its last reading.
- The agent probe (a listing of every process: PowerShell on Windows, ~500 ms)
  runs for a tile only after it printed since the last probe. Selecting a
  tile and the update restart still probe outright.
- Git (rev-parse + status, more for a workspace) runs every 30 s for the
  selected tile, every fourth tick for the others, not at all while the
  window is hidden.
- The background-session listing (a claude process, ~340 ms, here and on
  every connected machine) runs every 30 s while focused with rows, every
  minute when the group is empty, every two minutes unfocused.

The rules are pure functions in src/shared/idleCadence.ts, with tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX
writingdeveloper added a commit that referenced this pull request Oct 27, 2026
… only when they can matter (#69)

Measured on Windows with two idle sessions (1.47.0, 15 min): ~5% of a core,
mostly periodic work re-reading what the window already showed.

- The activity tick reads a terminal's screen tail only after the terminal
  was written to (output, a replayed screen, a repaint), and for two more
  seconds while xterm catches up; a quiet terminal keeps its last reading.
- The agent probe (a listing of every process: PowerShell on Windows, ~500 ms)
  runs for a tile only after it printed since the last probe. Selecting a
  tile and the update restart still probe outright.
- Git (rev-parse + status, more for a workspace) runs every 30 s for the
  selected tile, every fourth tick for the others, not at all while the
  window is hidden.
- The background-session listing (a claude process, ~340 ms, here and on
  every connected machine) runs every 30 s while focused with rows, every
  minute when the group is empty, every two minutes unfocused.

The rules are pure functions in src/shared/idleCadence.ts, with tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX
@writingdeveloper

Copy link
Copy Markdown
Owner Author

Merged into main by local squash; released as v1.48.0.

@writingdeveloper
writingdeveloper deleted the perf/idle-cost branch October 27, 2026 22:01
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