Files
pipelines/app/notes/mobile-chat-text-profile.md
T

4.0 KiB
Raw Blame History

Mobile chat text profile

Scope

Diagnostic-only profile of the real ChatThreadView with its isolated fake ApiGateway (tool/chat_composer_probe_entry.dart). The synthetic transcript contains prose, headings, inline emphasis/code, fenced Dart, links, lists and a 3-column Markdown table; the stream adds 80 incremental text updates. This is a focused widget fixture rather than a full shell/session-list capture. Runs were made in a quiet worktree on release web, headless Chrome at 560x1000 with software rasterisation. These are Chrome wheel/software-raster comparison numbers, not Android FPS; no authorized Android device was connected.

Reproduction

From app/, after checking that no competing Flutter build, test or capture was running:

/Users/alan/development/flutter/bin/flutter build web --release \
  --target tool/chat_composer_probe_entry.dart \
  --output build/mobile-chat-text-profile
node --check tool/chat_perf_probe.mjs
node tool/chat_perf_probe.mjs build/mobile-chat-text-profile 20 80 3 \
  > build/mobile-chat-text-profile-short.json
node tool/chat_perf_probe.mjs build/mobile-chat-text-profile 300 80 3 \
  > build/mobile-chat-text-profile-long.json

Each repetition uses fresh pages for open, 120 wheel gestures (60 up/60 down), and streaming. The JSON reports are in the ignored build directory. The probe was changed only to make the phone-width/repeat count explicit; the fixture was extended with the table above.

Measurements

Values below are medians across three repetitions. Frame timings are Flutter FrameTiming values. over16 is the count of measured frames over 16 ms in the software Chrome harness, not a device refresh-rate assertion.

workload frames build p50 / p90 ms raster p50 ms total p50 / p90 ms over16
open, 20 messages 13 2.6 / 4.3 26.2 29.6 / 31.8 13
open, 300 messages 15 2.5 / 4.3 25.7 29.3 / 32.5 15
scroll, 20 messages 120 1.4 / 6.7 25.0 28.0 / 36.0 120
scroll, 300 messages 245 1.5 / 6.8 24.7 27.6 / 35.9 245
stream, 20 messages 165 1.3 / 3.7 24.7 27.6 / 30.1 165
stream, 300 messages 160 4.8 / 5.8 24.8 29.4 / 32.0 160

Ranked findings

  1. Measured: raster dominates this scrolling harness. Build p50 is 1.4–1.5 ms while raster p50 is about 25 ms. These numbers cannot identify whether text, tables, selection, or CanvasKit compositing owns the raster cost, so they do not justify a Markdown rewrite.
  2. Measured: the long live answer costs more build time. Stream build p50 is 4.8 ms for 300 messages versus 1.3 ms for 20. This is consistent with the growing live Markdown turn and text layout, but it is not isolated proof that Markdown parsing alone is responsible.
  3. Measured: opening history is not strongly message-count-sensitive here. Open build and total medians are effectively unchanged from 20 to 300 rows. The transcript uses the existing row construction and ChatMarkdownCache; this does not prove all native-device layout costs are equivalent.
  4. Evidence-backed next candidate, not a defect finding: ChatMarkdownView renders tables with IntrinsicColumnWidth, so a focused visible-table A/B profile is warranted. It was included in this workload but not isolated from the rest of rich Markdown.

Next small experiment

Use the existing full-app tool/perf/perf_fixture.dart rich-chat fixture to isolate table-free versus table-rich visible answers, repeating touch and wheel separately at 560px. Then compare the same workload on an authorized native Android device before making a mobile performance claim. A diagnostic selection on/off comparison may follow only if the table experiment does not explain the raster cost; selection behavior must remain unchanged.

No production code or behavior was changed. Selection/copy, rich Markdown, scroll anchors and drafts remain unchanged. No app tests were run because this visit changed only profiling fixture/probe code and a note; node --check and the release build succeeded.