Repository navigation
perf: Measure RSS and multi-monitor cost on macOS - #590
Merged
Merged
Conversation
Adds scripts/bench-rss.sh and the numbers it produced for #424. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 10, 2026
cursor Bot
pushed a commit
that referenced
this pull request
Sep 11, 2026
…mode Change all three RSS bench scripts (macOS, Linux, Windows) from long research defaults (settle 300s, sample 300s) to brief smoke-test defaults (settle ~3s, sample ~10s). Add --research (bash) / -Research (PowerShell) flag to restore the long soak for measurement studies. Verification/benches must be brief so tens/hundreds of scenarios can stage/test/verify quickly. The 300s+300s (~10 min) default was cargo-cult from macOS #590 research soak; inappropriate for everyday verification. Changes: - scripts/bench-rss.sh: settle 3s, seconds 10s, interval 2s by default - scripts/bench-rss-linux.sh: same brief defaults - scripts/bench-rss.ps1: same brief defaults - All three scripts: add optional research mode flag for 300s+300s soak - docs: Updated to document both modes, default is brief smoke test - DEVELOPMENT.md: Note brief defaults, research mode available Short defaults enable fast scenario matrices; optional research mode preserves bathtub curve analysis capability when needed. Co-authored-by: Oded Messer <odedmesser@gmail.com>
cursor Bot
pushed a commit
that referenced
this pull request
Sep 11, 2026
…mode Change all three RSS bench scripts (macOS, Linux, Windows) from long research defaults (settle 300s, sample 300s) to brief smoke-test defaults (settle ~3s, sample ~10s). Add --research (bash) / -Research (PowerShell) flag to restore the long soak for measurement studies. Verification/benches must be brief so tens/hundreds of scenarios can stage/test/verify quickly. The 300s+300s (~10 min) default was cargo-cult from macOS #590 research soak; inappropriate for everyday verification. Changes: - scripts/bench-rss.sh: settle 3s, seconds 10s, interval 2s by default - scripts/bench-rss-linux.sh: same brief defaults - scripts/bench-rss.ps1: same brief defaults - All three scripts: add optional research mode flag for 300s+300s soak - docs: Updated to document both modes, default is brief smoke test - DEVELOPMENT.md: Note brief defaults, research mode available Short defaults enable fast scenario matrices; optional research mode preserves bathtub curve analysis capability when needed. Co-authored-by: Oded Messer <odedmesser@gmail.com>
omesser
added a commit
that referenced
this pull request
Sep 11, 2026
…mode Change all three RSS bench scripts (macOS, Linux, Windows) from long research defaults (settle 300s, sample 300s) to brief smoke-test defaults (settle ~3s, sample ~10s). Add --research (bash) / -Research (PowerShell) flag to restore the long soak for measurement studies. Verification/benches must be brief so tens/hundreds of scenarios can stage/test/verify quickly. The 300s+300s (~10 min) default was cargo-cult from macOS #590 research soak; inappropriate for everyday verification. Changes: - scripts/bench-rss.sh: settle 3s, seconds 10s, interval 2s by default - scripts/bench-rss-linux.sh: same brief defaults - scripts/bench-rss.ps1: same brief defaults - All three scripts: add optional research mode flag for 300s+300s soak - docs: Updated to document both modes, default is brief smoke test - DEVELOPMENT.md: Note brief defaults, research mode available Short defaults enable fast scenario matrices; optional research mode preserves bathtub curve analysis capability when needed. Co-authored-by: Oded Messer <odedmesser@gmail.com>
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.
Why
#424 asks for RSS and multi-monitor scaling numbers, and #423 cannot rank
optimization targets until its children come back with baselines. Nothing in
the repository measures memory, and the ticket's hypothesis — "RSS scales with
display count, each webview ~100–200 MB" — was unchecked.
This machine is macOS with two displays attached, which is the multi-monitor
axis the ticket asks about, and RSS is readable from the shell. So the macOS arm
is answerable here. Linux and Windows are not, and this pull request does not
guess at them.
What changed
Two files, plus a pointer.
scripts/bench-rss.sh— launchestarget/debug/ai-buddy, settles, samplesevery process's RSS to a TSV, and reads each one's peak physical footprint
before stopping the app. Scenarios are chosen by environment
(
AI_BUDDY_INSTANCES,AI_BUDDY_CHARACTERS), so the script has no knowledgeof them.
docs/research/memory-rss-and-multi-monitor.md— the four runs, themethod, and what could not be measured.
docs/agents/docs.mdputsinvestigation in
docs/research/.docs/DEVELOPMENT.md— one line under Automated Scripts.Three decisions a reviewer would otherwise have to reverse-engineer:
out-of-process and those helpers are children of
launchd, sopson the apppid reports about a third of the total. The script takes the set of WebKit
helpers before and after launch and calls the difference the app's — and warns
when the count is not
displays + 2, because another application starting ahelper in that window would land in the set. That happened once during this
work and the run was discarded.
macOS has let a process keep. On a machine shared with other agents building
and running, the four-Instance run read 33 MB lighter than the one-Instance
run purely because it was sampled when free memory was 25–29 % rather than
33–43 %. Peak footprint only rises, so it survives that. Both are reported.
by 150 s, and comes back to ~225 MB by 300 s. A number taken in the first
minute is the loader's.
What it does not do: no heap profile. #424 asks for Instruments Allocations or
heaptrack, and Instruments needs a GUI session and a human. The document saysso and names the 47.6 MB finding below as the first thing to point one at.
How to verify
Ran: four 10-minute runs on 2026-09-09 (MacBook Pro
Mac15,7, 36 GB,macOS 26.6.2; DELL P2414H 1920×1080 @1× and the built-in 3456×2234 @2×), a
15-minute soak for the settling curve, and a 50-second smoke run of the final
script (exit 0, app stopped, no contamination warning).
pre-commit run --filespasses on all three files; no Rust changed.
Peak physical footprint, MB:
ai-buddyWhat the numbers say:
is pixels, not displays. The Retina overlay is 75–110 MB heavier than the
1080p one in every run, and the ratio is the ratio of backing stores. Plan on
120–170 MB for a 1080p display and 200–280 MB for a Retina one.
+56 MB, all of it in the two
WebContentprocesses; the Rust process's peakwas 82.9 MB in both runs, to the tenth of a MB.
load_all_charactersloads every installedpackage at launch, so the art switched to is already resident. Read off the
code path, not a driven switch — the tray menu needs a human.
animation live at that instant: idle 260 MB, walk 245, sit 260, talk 260,
climb 240. The spread between animations is smaller than the spread within any
one of them.
Rust process — ten times the 4.5 MB of base64 they amount to. Unexplained, and
flagged as the target for the heap profile this PR does not have.
Notes
target/debug; a user runs release. TheRust process's share is an upper bound. The WebKit helpers are release code
regardless.
attached and an agent cannot unplug one. The per-display cost is read off the
process split instead, which answers the same question but is an inference
from the architecture rather than a two-configuration measurement.
another agent's
ai-buddyand one was contaminated by another application'sWebKit helper; both were discarded and repeated. The free-memory column in the
document is that load.
Closes #424
🤖 Generated with Claude Code
— Claude Code, on @omesser's behalf.