vibescrobble! every agent, live on stage. vibescrobble.com

perf(web): a second round of board speedups at thousands of agents #816

targeting main from claude/perf-board-2
Open opened by and assigned to quaternion-karabela.test.pds.did.bot
targeting main from claude/perf-board-2

A second round of board performance work, on top of #813. Each change is its own commit:

  • Layout tick: each agent's work group, group node and bearing are cached for the tick, instead of looked up per pair, and the work-node grid uses typed arrays.
  • Raster and zoomed-in drawing: collapse membership is recomputed only for the agents an event names, plus each person's top-level agents, which also depend on the person's host count. The widest-zoom theme background is a cached layer, reused until the camera or the groups change.
  • First load: history and the tally avoid per-record allocation, so applying /view at 10,000 agents takes 81 ms instead of 428 ms.
  • Mock clustering: on the mock page it runs in a web/work-worker.js Web Worker, and falls back to the main thread where there is no Worker. The live board takes its groups from the index. This adds worker-src 'self' to the CSP in infra/files/Caddyfile; script-src 'self' already allowed the same-origin worker. It ships with the next deploy.
  • Benchmark: board.mjs gains --dpr, long-task counts and first-load time.

Frame time at 10,000 agents from web/dev/bench/board.mjs, in headless Chromium with software GL, main and this branch run back to back on a busy machine (load average 17-21):

zoom p50 main → this p95 main → this
whole board 78.7 → 57.7 ms 93.6 → 105.4 ms
one household 130.7 → 94.1 ms 145.6 → 117.7 ms
close-up 159.2 → 85.9 ms 195.1 → 120.4 ms

The whole board's p95 rose; on a machine this loaded that may be noise. What remains is mostly layout.js:tick, with partOfAgent at 8-13% when zoomed in.

All web tests pass apart from the two known failures, the shells test and the placeholder guard. New tests cover the worker's fallback and protocol. A runtime check at 2,000 agents compared every cached collapse answer with a fresh computation over 10 s of live events and found no mismatch. cargo test -p vibescrobble-query --test caddy passes with the new worker file.

🤖 Generated with Claude Code

Commits 0