Skip to content

perf(mobile): speed up large Android threads - #5393

Draft
shivamhwp wants to merge 5 commits into
pingdotgg:mainfrom
shivamhwp:perf/android-large-thread-loading
Draft

perf(mobile): speed up large Android threads#5393
shivamhwp wants to merge 5 commits into
pingdotgg:mainfrom
shivamhwp:perf/android-large-thread-loading

Conversation

@shivamhwp

@shivamhwp shivamhwp commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Large Android threads could hydrate unbounded database history, retain multi-megabyte tool payloads, repeatedly parse timestamps while rebuilding the feed, and wait on a failing native highlighter probe. Cold thread routes also replaced an empty loading toolbar with the hydrated title/actions, causing a visible layout shift.

This change:

  • bounds database-backed detail history to the live projector limits while preserving unbounded checkpoint history for operational turn-diff lookup;
  • compacts superseded context-window telemetry before applying the activity limit, retaining unresolved rows;
  • projects oversized command/MCP payload previews without changing persisted data;
  • parses feed timestamps once and uses recycling-aware Android rows with content-keyed feedback state;
  • renders the Android loading/unavailable toolbar at final geometry, including a working cold-route back/Home fallback;
  • uses the documented JavaScript highlighter by default instead of waiting for a failing native probe.

Production-shaped Android emulator A/B, using the same copied thread data and no screen recording:

  • 478 messages / 6,696 activities: cached snapshot 3.01 MB → 1.05 MB; load RSS growth ~204 MB → ~21 MB; p50/p95 42/150 ms → 26/81 ms; janky frames 36.4% → 30.4%.
  • 102 messages / 1,649 activities: cached snapshot 775 KB → 356 KB; p95 81 ms → 57 ms.
  • 4-message control: p50/p95 remained 17/57 ms.
  • highlighter initialization: ~5.2 s native failure/fallback → ~0.64 s direct JavaScript initialization.
  • loading and hydrated Android header title/action bounds were visually verified to remain fixed.

Verification:

  • 52 focused server/mobile tests across projection queries, projector behavior, payload projection, highlighter selection, and thread activity
  • mobile and server typechecks
  • targeted formatting and lint
  • Android API 36 preview-build passes across tiny, medium, giant settled, and active copied threads
  • independent Claude Code/Fable and Codex performance audits; the checkpoint-history coupling they found was fixed before this update

Implemented with GPT-5.6 Sol in the T3 Code Codex harness, with an independent Claude Code/Fable review.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c9ccfcfa-b599-4e95-84d2-3e7eebb413ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 5, 2026
Comment thread apps/mobile/src/features/threads/ThreadFeed.tsx
Comment thread apps/server/src/orchestration/ActivityPayloadProjection.ts
@shivamhwp
shivamhwp force-pushed the perf/android-large-thread-loading branch from b3d6668 to 0ebe016 Compare August 5, 2026 09:51
Comment thread apps/server/src/orchestration/ActivityPayloadProjection.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant