perf(mobile): avoid reparsing unchanged Markdown - #7649
Conversation
Signed-off-by: Tom Brow <tomb@block.xyz>
|
@codex review |
🔐 Codex Security Review
|
|
@builderbot review |
|
@buzz-security-review 6af20bc |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@buzz-security-review 6af20bc |
1 similar comment
|
@buzz-security-review 6af20bc |
jedwards27
left a comment
There was a problem hiding this comment.
:bot: Jude’s code review agent — APPROVE at exact head 6af20bc4c226bb79f915121d0c3c5e006c91e4cb (base 7c789dee09d198469bded1cb5be902eaf5562ad9).
No author-actionable defects found.
The cache contract is coherent end to end:
_InlineComponentInputssnapshots all changed rendering inputs by value—content/rendered content, mention labels and bindings, agent/channel data, emoji, size, raw tags, and action presence—so meaningful changes invalidate while equivalent rebuilds preserve inline-component identity (mobile/lib/features/channels/message_content/inline_components.dart:32-135).- Stable forwarding closures read handler refs refreshed on every build; adding/removing actions participates in invalidation. Mention, channel, reply, more, and media callbacks therefore remain current without forcing Markdown reparsing (
inline_components.dart:18-31;message_content.dart:181-207). - Raw-tag invalidation refreshes media metadata and regenerated spans; tests cover updated alt text and action removal (
message_content.dart:214,292-342;message_content_stability_test.dart:98-154). - Retention is per mounted widget, not static/global. Message rows are keyed by event ID, and unmounting releases hook state, so lazy-list recycling does not transfer cached inputs between logical messages (
message_bubble.dart:103-143;message_list.dart:776-825). - This targets the actual dependency seam:
gpt_markdown1.2.1 regenerates when its expression changes orconfig.isSamefails, and that comparison uses inline-component element identity. Mutation checks confirmed that removing memoization fails the identity regression and stopping ref refresh fails latest-handler assertions.
Exact-head evidence:
- Full mobile tests: 2,127 passed.
flutter analyze: no issues; format/check task clean.- Directly affected message suites: 97 passed.
- CI, DCO, Semgrep, and zizmor are successful; irrelevant jobs are skipped.
- Live PR head was rechecked immediately before this review.
Residual confidence gaps, with author action: none:
- The PR-body synthetic
30 → 0parser-call count was not independently reproduced because its instrumentation is not checked in. The checked-in identity test plus mutation failure causally verifies the production cache predicate, but not that exact numerical measurement. Verification owner: reviewer/performance tooling. - No native iOS visual/VoiceOver/tap/recycling journey or same-device frame-time cohort was run. Widget/full-suite coverage is strong; remaining risk is native-only lifecycle or rendering behavior outside that harness. Verification owner: reviewer/release tooling.
…ush-cache-offload * commit '41c5ace93740261ee5a5d962c2a17e8d846c2c1b': perf(mobile): move profile sig checks off main thread (#7648) perf(mobile): avoid redundant message list sorting (#7647) perf(mobile): avoid reparsing unchanged Markdown (#7649) Fix desktop onboarding regressions (#7659) Deduplicate thread context by ACP session delivery (#7620) feat(mobile): hard-block under-18 users on the store age signal (#4665) Document incoming Buzz turn structure (#7624) Refresh desktop onboarding flow (#7528) Fix Apple Silicon iOS simulator builds (#7646) Signed-off-by: Tom Brow <tomb@block.xyz>
When a channel screen updates, Buzz Mobile can parse and format a message again even when its text has not changed. This repeated work runs on the same thread that handles taps and updates the screen.
The current Markdown library,
gpt_markdown1.2.1, checks whether the objects used to render mentions, emoji, and channel links have changed. Buzz creates new objects on every message rebuild, so the library parses the message again. This change reuses those objects while their inputs stay the same. Changes to labels, mention targets, emoji, media details, or available actions still update the message. Taps continue to use the latest action handlers.In a synthetic test with the production message widget, ten unchanged rebuilds caused 30 parser calls before this change and zero after it. The first render still requires parsing. This test measures repeated parsing, not overall screen speed.
Validation: