Repository navigation
Performance: Testing - Buy/Sell/Swap trade scenarios and profiling - #2507
JohnathanWhite wants to merge 1 commit into
Conversation
Adds the trade-flow half of the performance harness on top of the perf framework from bitpay#2475: Maestro scenarios that drive Buy, Sell and Swap read-only (quotes load, nothing is confirmed, signed or submitted), per-scenario accepted runs and per-screen transition comparisons, a JS-CPU flow profiler, the process-memory mode recorded per run, and the trade findings. - perf/scenarios/trade_{buy,sell,swap}.yaml - the three flows. - perf/loop/flowprofile.sh - JS CPU profile of a flow. - perf/loop/FINDINGS-trade.md - root causes, baselines, parked items. - perf/{cli,collector,config,compare,drivers/android,iterate} - per-scenario runs, coin-list and quote spans, memory-mode recording. - src/perf/PerfMonitor.ts - spanStart/spanEnd for sub-screen timing. - Android PerfMarks/MainApplication - non-perf builds compile against the new startJsProfiler(context); perf marks for the profiler. Jira: RN-3106
cmgustavo
left a comment
There was a problem hiding this comment.
Tooling-only change; CI is green and nothing here is reachable from production builds. One item inline (receiver registration on Android 14+). Minor, unverified: readMemoryMb matches ^\s*Unknown:\s*(\d+). In dumpsys meminfo I'd expect "Unknown" as a table row without a colon and "Private Other" in the App Summary, so on some devices unknown_mb_start may come back null and the memory-mode check would silently not work. Worth confirming against raw output from the test phone.
| } | ||
| } | ||
| } | ||
| context.registerReceiver(receiver, IntentFilter("com.bitpay.wallet.PERF_JS_PROFILE")) |
There was a problem hiding this comment.
registerReceiver(receiver, filter) without a flag throws SecurityException on Android 14+ for non-system actions (targetSdk is 36). It's called from Application.onCreate outside the try/catch, so a BP_PERF_PROFILE=1 build would crash on launch on API 34+ (it works on the Android 11 test phone). Also, adb shell am broadcast needs the receiver to be exported. Suggest context.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED) and moving the registration inside the try/catch.
Summary
The trade-flow half of the performance harness, on top of the perf framework merged in #2475. Tooling only — no app behaviour changes. The product-code optimisations these scenarios measure are in #2506.
What's here
perf/scenarios/trade_{buy,sell,swap}.yaml. Maestro flows that open Buy, Sell and Swap, choose coins and amounts, and let quotes load. They are read-only: nothing is confirmed, signed or submitted, and the flows never tap a provider's checkout.perf/loop/flowprofile.sh: a JS-CPU profile of a single flow.perf/loop/FINDINGS-trade.md: root causes, baselines, the two REJECT→override calls (memory mode, CPU-as-a-rate), and parked follow-ups.perf/{cli,collector,config,compare,drivers/android,iterate}: per-scenario accepted runs, per-screen transition comparisons, coin-list and quote spans, and the process-memory mode recorded per run.src/perf/PerfMonitor.ts— addsspanStart/spanEndfor sub-screen timing (currently unused by shipped screens; instrumentation can be wired in separately).PerfMarks/MainApplication: non-perf builds compile against the newstartJsProfiler(context); perf marks for the profiler.Notes
developafter Android: perf - misc updates #2475 merged, so it stands alone.PerfMonitor's new span API has no consumers in this PR by design — the Buy/Sell/Swap screens aren't instrumented here, keeping this PR tooling-only.Jira: RN-3106