Responsiveness and animations on every profile
Status: in progress.
Budgets
CPU throttled 4 times stands for a weak machine, 6 times for a TV; to confirm on hardware.
| Measure | Budget |
|---|---|
| idle page | at most 5 ms of main thread per second at 4 times, no long task, no request outside pushes |
| WebSocket during playback | at most 2 KB/s; initial state limited to subscribed outputs |
| permanent animations, gestures | transform and opacity only (tests/motionBudget.test.ts); press to frame at most 100 ms at 4 times |
| list routes, /api/health under load | at most 50 ms on a desktop |
Reference profile
Desktop, headless Chrome, CPU 6 times, 10 s idle, seeded bench, main after 472 (2026-12-03, measured): only /radio/ (15.3 ms/s of script) and /metrics/courses/ (7.5 ms/s of long tasks) went over budget; the cost is React’s render loop, no pure JavaScript computation, so WebAssembly is not justified.
Steps
| Step | Content | State |
|---|---|---|
| L4 | position computed in the leaves on /radio/ (473) and the coach (487); schedule occurrences without N+1 (486: 479 to 12 queries, two months 150 to 50 ms) | done; marquee titles off screen and a full /radio/ render per tick remain |
| L5 | /storage/ shows volumes without waiting for portable drives (488: 595 to 50 ms) | done |
| L6 | elements at load on an 800-video, 3 000-track bench: /cinema/ 14 537 to 743, /library/radio/ 30 164 to 604, /library/ 8 996 to 442 (479 to 484) | done; dialog pickers and /library/ table remain |
| L7 | tray menu read in 0.9 ms, 3.9 ms under 8 writers | closed without code |
| L9 | an in-memory store per API route in the persistent layout, shown at once, revalidated by WebSocket or visibility, never by timer; prefetch on hover or idle | to do |
| L10 | one broadcast socket per tab (485); internal links through next/link (489) | done |
| Q7 | Firefox check of loop delay during import, unstable (2 to 242 ms); instrumented (490): peaks after reloads of /api/videos and /api/media/names | open, acted on at the next overrun |
Pitfalls
Simulate a remote press with keydown then keyup, or repetition filters the next presses. Measure a windowed row with getBoundingClientRect().height, never offsetHeight. After a scripted scroll, wait three animation frames, never a bare timeout. Use a fresh browser per measured page. content-visibility: auto on 3 000 rows costs more than it saves.