Skip to content

[IOURequestStepScan Decomposition] Verify perf + subscription counts post-decomposition #89386

Closed

Description

@cristipaval

Held on #89385

Part of IOURequestStepScan Decomposition Plan — see rinej's split design comment.

Parent: #85583

Problem

We need a clear before/after signal that decomposition reduced render pressure on the scan surface (time to interactive and/or subscription breadth).

Solution

Re-run the measurement scenario and expectations from the plan thread (e.g. FAB → scan ready on a reference device) and, if useful, summarize Onyx subscription differences per variant versus the old monolith.

Activity

  1. melvin-bot commented on May 4, 2026

    @melvin-bot

    @bernhardoj Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  2. changed the title [-][IOURequestStepScan Decomposition] Verify perf + subscription counts post-decomposition[/-] [+][HOLD] [IOURequestStepScan Decomposition] Verify perf + subscription counts post-decomposition[/+] on May 5, 2026
  3. cristipaval commented on May 5, 2026

    @cristipaval
    ContributorAuthor

    Held on #89385

  4. melvin-bot commented on May 8, 2026

    @melvin-bot

    @rinej Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  5. cristipaval commented on May 11, 2026

    @cristipaval
    ContributorAuthor

    still held

  6. 5 remaining items

  7. cristipaval commented on May 25, 2026

    @cristipaval
    ContributorAuthor

    Still on hold

  8. changed the title [-][HOLD] [IOURequestStepScan Decomposition] Verify perf + subscription counts post-decomposition[/-] [+][IOURequestStepScan Decomposition] Verify perf + subscription counts post-decomposition[/+] on Jun 2, 2026
  9. cristipaval commented on Jun 2, 2026

    @cristipaval
    ContributorAuthor

    HOLD removed

  10. cristipaval commented on Jun 11, 2026

    @cristipaval
    ContributorAuthor

    @rinej, could you please do the post-decomposition verification? 🙏

  11. rinej commented on Jun 16, 2026

    @rinej
    Contributor

    yes, I will work on it

  12. rinej commented on Jun 17, 2026

    @rinej
    Contributor

    I'm posting the measurement summary. @cristipaval Let me know if this is enough, or if you'd like us to explore the details further

    Post-decomposition verification

    Following the methodology I used on the WIP branch (#85571) as the baseline, here's the before/after on the same Android device

    What changed

    The monolithic IOURequestStepScanwas decomposed into a thin router + 4 focused variant components, each subscribing only to the Onyx data its flow actually needs:

    Variant Purpose
    ScanEditReceipt Replace receipt → navigate back
    ScanFromReport Set participants from report → confirmation
    ScanGlobalCreate Auto-reporting → navigate (the FAB path)
    ScanSkipConfirmation Direct submit, GPS gate, split bill

    A shared Camera component + MultiScanContext was extracted alongside. The work landed across 4 sequential PRs (#87083, #87883, #89384, #89385).

    TTI: FAB → Camera ready (Android, same device)

    Flow: cold-start app → tap FAB → Create Expense → Scan → wait until viewfinder is live.

    Metric Pre-decomp (Apr 2026) Post-decomp (Jun 2026)
    ManualOpenCreateExpense avg 1337.2 ms 823.2 ms
    Worst-case (max) n/a 1032 ms

    Per-iteration values Post-decomposition:

    Iter ManualOpenCreateExpense (ms) ManualCameraInit (ms)
    2 846 106
    3 774 49
    4 1032 2
    5 905 53
    6 877 2
    7 703 8
    8 685 26
    9 698 50
    10 889 141
    Mean 823.2 48.6

    Every single iteration is faster than the pre-decomp baseline - even the worst case is ~23% faster.

    Onyx subscription footprint per variant

    Counted at call-site level (each useOnyx / Onyx-backed hook in the variant file). Shared hooks like useDefaultExpensePolicy use selectors so their internal subscriptions are narrower than a raw collection sub.

    Path Subs (post) Subs (monolith)
    ScanEditReceipt 4 ~27
    ScanFromReport 3 ~27
    ScanGlobalCreate (FAB) 8 ~27
    ScanSkipConfirmation ~21 ~27

    The two most common interactive paths (ScanFromReport, ScanEditReceipt) now subscribe to 3–4 keys instead of ~27. Global Onyx chunk (new chat messages, report updates) no longer reaches them - addressing the parent issue's camera-jank root cause.

    ⚠️ Important note - the -38% is not only because of the scan decomposition.
    Roughly 2 months elapsed between the pre- and post-measurements. During that window, other performance-improvement initiatives also landed on main (selector additions to shared hooks, mount-path optimizations, related render-pressure reductions across IOU flows). The scan decomposition is one contributor but not the only driver of the headline number.

    Some additional measures from Sentry

    See the recent comment - aggregated p50/p90/p95 over real-user windows on both iOS and Android, showing meaningful improvements (Android p50 ManualEntryToScan -12.6%, -12.8% on ready; iOS p50 improvements up to -14.7% at p95) on the related FloatingCameraButton entry path. Different span and entry path than the local measurement above, but confirms the directional improvement at scale.

    Conclusion

    • TTI on the FAB path improved -38% vs the pre-decomp baseline (1337 → 823 ms), with contributions from both the decomposition and other perf initiatives that landed in the same window.
    • Onyx subscription footprint dropped substantially on every variant, the two most common paths went from ~27 to 3–4
  13. Julesssss commented on Jun 17, 2026

    @Julesssss
    Contributor

    The refactors are looking good! I think we could stop here for now and switch to other flows, if there are no other immidiate candidates for improvements.

    👍 achieved

  14. cristipaval commented on Jun 17, 2026

    @cristipaval
    ContributorAuthor

    yeah, I think it looks good. In practice I can feel that the feature works smoother 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Weekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions