Files
buzz/mobile/lib
Tom Brow 9aa70124ba perf(mobile): validate each verified profile once, not on every publish (#9101)
Opening or resuming a big channel spent about 210 ms of UI-thread CPU
validating verified profiles, measured in Dart CPU samples on an iPhone
12 mini (Profile build) across two separate channel-resume captures (213
ms and 211 ms in `VerifiedProfilesNotifier._snapshot`, nearly all of it
in `parseVerifiedProfile`).

Every publish rebuilt the profile map by validating every known head
again, and a channel with many members publishes once per subscription
batch as each lands, so the work grew with members times batches. Each
subject's parse is now kept while its head and the authority stand. Only
`checked` changes between publishes (rebatching unchecks and rechecks
subjects), so it is applied to the kept parse without validating again.

### Validation

- Added `a later batch reuses profiles already parsed`: after a second
subject rebatches the first, each head is validated exactly once. It
fails when the kept parse is ignored.
- `flutter analyze` is clean and the full mobile suite passes.
- Same phone and scenario after this change: `parseVerifiedProfile` no
longer appears in the resume CPU samples, and main-isolate message
handling over the 15 s after resume dropped from 604 ms to 491 ms (one
run each). Frame build and layout time on resume is unchanged; that is
separate work.
- Automated app run on the same phone with this change: Home, search,
the large channel and its resume after the reconnect grace period.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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>
2026-11-05 11:31:38 -08:00
..