Skip to content

fix(mobile perf): avoid eager emoji palette scans for prose - #8416

Merged
brow merged 1 commit into
mainfrom
mobile-emoji-detection-cost
Oct 17, 2026
Merged

brow merged 1 commit into
mainfrom
mobile-emoji-detection-cost

Conversation

@brow

@brow brow commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Ordinary mobile messages eagerly built a set of every community emoji shortcode and segmented their entire body just to decide whether to use enlarged emoji rendering. Stop at the first non-emoji grapheme and build the shortcode set only when a complete shortcode is encountered. Emoji-only sizing and shortcode matching stay unchanged.

Validation

  • Full just ci passed.
  • 125 focused detector and message-rendering tests pass; targeted analysis is clean. The palette-access regression fails on the original implementation (10,320 unnecessary reads) and passes with the fix. It also checks that consecutive shortcodes share one palette scan.
  • Full Buzz app, real community data, debug/JIT iOS simulator, not a rendering fixture: two paired actual-input captures measured 125–127 µs per original detector call versus under 1 µs with the fix. All 5,200 executions per version agreed across 260 observed prose calls and a 2,580-entry palette. Instrumentation repeated each detector call, so these captures are excluded from frame comparisons.
  • Separate clean-code scrolling runs do not establish a reliable smoothness improvement: quiet original UI-callback p95 was 10.1–12.6 ms versus 10.1–12.9 ms fixed. A busy fixed run still reached 90.8 ms. Normal app services stayed enabled; only scrolling was exercised. Live background refresh, debug mode, host scheduling, and profiler overhead limit interpretation. No physical-device/release-AOT or end-to-end interaction-latency claim.

Signed-off-by: Tom Brow <tomb@block.xyz>
@brow

brow commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T23:21:52.329649Z acba238 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: acba238417

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@brow brow changed the title fix(mobile): avoid eager emoji palette scans for prose fix(mobile perf): avoid eager emoji palette scans for prose Oct 17, 2026
@brow
brow marked this pull request as ready for review October 17, 2026 23:20
@brow
brow requested a review from a team as a code owner October 17, 2026 23:20
@brow
brow deployed to codex-review October 17, 2026 23:20 — with GitHub Actions Active
@github-actions github-actions Bot added the codex-security-review-current The posted Codex security review matches its recorded range. label Oct 17, 2026
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated, security-focused review generated by Codex.
Use it as a supplement to human review; false positives are possible.

Scope

  • Exact PR diff: 6286a5432111f529835da320e801af1901889b03...acba2384179e16bdece3a356caa47126b95a56a3
  • Model: gpt-6.1-sol

💡 Click "edited" above to see earlier reviews for this PR.


Review Summary

Overall Risk: NONE

No concrete security, correctness, or reliability findings. The streaming scan preserves emoji classification behavior while avoiding eager message and palette processing.

Findings

No concrete security, correctness, or reliability findings were identified.

Notes

  • Reviewed the exact authorized diff, rendering caller, emoji normalization, and relevant tests. Tests were inspected but not executed, as requested.

Generated by Codex Security Review |
Requested by: @brow |
Workflow run

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:bot: Jude’s code review agent

Verdict: APPROVE

Reviewed: 6286a5432111f529835da320e801af1901889b03..acba2384179e16bdece3a356caa47126b95a56a3 (exact live head acba2384179e16bdece3a356caa47126b95a56a3, clean review tree)

Risk: Medium — this changes a shared detector on the full mobile channel/thread rendering path, but the change is bounded to classification performance and preserves the existing sizing/rendering contract.

Behavior/contracts traced: Channel and thread message bodies opt into emoji-only scaling; MessageContent supplies merged event/community emoji data to the detector before selecting 36px text and enlarged custom-image sizing (mobile/lib/features/channels/channel_detail_page/message_bubble.dart:313-332, mobile/lib/features/channels/thread_detail_page/thread_message.dart:285-304, mobile/lib/features/channels/message_content.dart:261-303). The replacement loop remains grapheme-based, handles whitespace, keycaps, pictographic/ZWJ emoji, complete case-insensitive custom shortcodes, adjacent tokens, and mixed prose while delaying the community-palette scan until a closed non-empty shortcode actually requires it (mobile/lib/shared/emoji/emoji_only.dart:44-85). The shortcode set is local to one invocation and reused within that invocation, so this introduces neither cross-community cache state nor stale-palette behavior.

Findings: No blocking or non-blocking code/product defect found. Independent systems and product/adversarial passes agreed on the exact head. A 41,371-input old/new differential probe over colon forms, known/unknown and case-varied shortcodes, prose, whitespace, composed/decomposed Unicode, keycaps, ordinary and ZWJ emoji found identical classifications. Instrumentation found zero palette reads for prose, Unicode-only, mixed prose-before-shortcode, and unclosed-shortcode inputs, with one 2,580-entry scan shared by consecutive valid shortcodes. Added tests bind the production detector’s lazy-access contract, and existing widget tests bind detector output to enlarged native/custom rendering and normal mixed-prose sizing (mobile/test/shared/emoji/emoji_only_test.dart:54-100, mobile/test/features/channels/message_content_test.dart:603-669, mobile/test/features/channels/message_content_stability_test.dart:239-289).

Author action: none.

Verification owner: Exact-head CI owns the required repository gates. Reviewer/tooling owns optional native observation or independent release/physical-device profiling; no author rework is indicated.

Validation:

  • PASS — git diff --check 6286a5432111f529835da320e801af1901889b03..acba2384179e16bdece3a356caa47126b95a56a3; only the two declared mobile files changed.
  • PASS — pinned-Hermit just mobile-check: 752 files format-clean, Flutter analysis reported “No issues found,” and mobile recipe checks passed.
  • PASS — targeted exact-head formatting/static analysis.
  • PASS — exact-head CI merge ref 696dd1f (this head into this base): all three full mobile test shards passed (3,498 passed, 4 skipped total); Mobile Checks, Android, native Swift, release Swift, Mobile aggregate, DCO, Semgrep, and zizmor are green.
  • PASS — live pre-submit freshness: PR head and clean local HEAD both matched acba2384179e16bdece3a356caa47126b95a56a3; PR mergeable; no review threads.

Manual/native evidence: No independent simulator or physical-device capture was completed. Local Flutter tests were blocked before execution because this reviewer host has not accepted the Xcode license (xcrun rc 69 during objective_c native-asset setup). The author-reported full-app debug/JIT detector measurement is therefore treated as author-reported, not independently audited.

Residual risk: The source and exact-head unit/widget/CI evidence establish semantic parity and removal of eager palette reads, but do not independently establish release-AOT or physical-device smoothness. The PR appropriately limits its claim to reduced detector work and explicitly disclaims a reliable scrolling improvement, so this is a non-blocking reviewer/tooling confidence gap rather than an author-actionable defect.

Minimalness, elegance, and correctness: 9/10+.

@brow
brow merged commit a96ace4 into main Oct 17, 2026
54 checks passed
@brow
brow deleted the mobile-emoji-detection-cost branch October 17, 2026 23:53
wpfleger96 pushed a commit that referenced this pull request Oct 18, 2026
…ogging

* origin/main:
  fix(mobile): polish Inbox controls and system notices (#8423)
  fix(mobile perf): avoid eager emoji palette scans for prose (#8416)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
brow added a commit that referenced this pull request Oct 18, 2026
* origin/main:
  fix(mobile): bump Flutter 3.47, resolving memory leak (#8419)
  fix(mobile): bound search result rendering work (#8418)
  Polish mobile message layout and navigation controls (#8427)
  feat(relay): start a channel with its members in one create (#8421)
  fix(desktop): bump zip to 9 for RUSTSEC-2026-0367/0368/0369 (#8412)
  fix(deps): bump negentropy to 0.5.2 for RUSTSEC-2026-0365 (#8409)
  chore(deny): exclude buzz-mesh-smoke from cargo-deny graph (#8413)
  fix(mobile): polish Inbox controls and system notices (#8423)
  fix(mobile perf): avoid eager emoji palette scans for prose (#8416)

Signed-off-by: Tom Brow <tomb@block.xyz>
brow added a commit that referenced this pull request Oct 20, 2026
Backport the merged emoji-scan optimization (#8416) and DM display-label
sorting fix (#8488) to `mobile-v0.25` for 0.25.1 RC2. Ordinary prose
avoids eager emoji-palette scans, and DM sorting resolves each display
label once per invocation while preserving ordering.

Both changes are clean cherry-picks of their merged revisions. Existing
stable-branch contents are preserved; preference-crypto reuse is
reserved for a later candidate. No overlapping open stable-backport PR
or issue was found.

### Validation

- All 11 focused emoji-detector and DM-sorting tests pass; affected
files match their merged source revisions.
- Full mobile pre-push checks and full repository `just ci` pass. Codex
review completed with no findings.
- The local branch-skew check assumes `main`, so it was excluded for
this stable-target backport. Required stable-branch CI and review remain
enforced.
- No new device capture. Stable-target security review is unavailable
under the current main-only workflow policy.

---------

Signed-off-by: Tom Brow <tomb@block.xyz>

This branch was successfully deployed

1 active deployment
codex-review — acba2384 Deployed Oct 17, 2026 by brow via Run Codex Security Review #8679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-security-review-current The posted Codex security review matches its recorded range.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants