mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Each working row on Home (the three pulsing dots next to a Solo chat whose agent is working) ran its own 60 fps animation. So an idle Home with any working agent produced a frame on every vsync. Painting the dots is cheap. The frame itself is not: each one costs the app, backboardd and the kernel together, and on the iPhone SE that adds 8.6% of battery per hour over static dots. The rows now step from one shared clock: 17 steps per 1400 ms cycle (about 12 fps), with the same cosine wave. All rows read the same step, so they stay in phase and repaint in the same frame. The clock runs only while a row is visible with `TickerMode` on and the app is in the foreground, so a Home with no working rows, a covered or off-screen Home, or a backgrounded app has no timer. ### Validation Idle Home with working agents, 30 s Time Profiler, % of one core, iPhone 12 mini (release builds of main and this branch; real working agents, 3 rows in the before run and 2 in the after run, which doesn't matter because the cost is per frame, not per row): | | Buzz | backboardd | kernel | Total | |---|---|---|---|---| | Before (60 fps) | 43.3 | 42.0 | 18.9 | 104.2 | | After (12 fps) | 14.9 | 15.7 | 14.8 | 45.4 | Earlier battery runs on the iPhone SE (2nd gen), whole-device gauge, 8 min per variant, same setup: 60 fps +600 mW (+8.6%/h) over static dots; 12 fps +109 mW (+1.6%/h). Two working rows on a simulator: Before (60 fps): <video src="https://github.com/user-attachments/assets/539ce17d-7df4-4508-a981-4d6b31f8f805" width="400"></video> After (12 fps): <video src="https://github.com/user-attachments/assets/18513348-6f24-48c5-bb3b-4ac328d0c983" width="400"></video> - Added tests: `solo_working_dots_test.dart` checks that rows step together at about 12 fps with no frames scheduled between steps, and that the shared timer is gone when the last row is removed, when `TickerMode` is off, and while the app is hidden. - Full mobile suite passes (4912 tests). The one failure is `search_channels_journey_test.dart`, which doesn't compile on main; [#9545](https://github.com/block/buzz/pull/9545) fixes it. - Automated app run (signed-in simulator, every Solo row forced to working with a local-only patch): the rows pulse in phase on Home, keep pulsing after opening a chat and going back, and after backgrounding and resuming the app. ### Regressions - The pulse steps at 12 fps instead of animating smoothly. Side by side in the recordings it reads the same; you notice the steps only if you look for them. - Rows are now in phase with each other instead of each starting its wave when it mounted. - Reduced motion still shows static dots at full opacity, as before. --------- Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>