mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
0b545c3c49
Every `launch:` step slept a flat POST_LAUNCH_SETTLE_MS (1500ms) before the run's first step, to give a cold start a head start. `restart-app` already waits for the activity to be displayed (`am start -W`), so on any app that is already drawing, that whole window was dead time. The condition the sleep approximated is observable: the flow's own tree source either shows the app's content or it does not. Poll it instead, with the same 1500ms as an upper bound — a warm app continues after one read, a genuinely slow start still gets the full window. The wait stays deliberately forgiving, so nothing that passed before can start failing: a tree that never fills (a canvas or video first screen), or a read that throws, spends the budget and carries on exactly as the sleep did. The tree-source gate still runs first and is still what reports an unusable source; this is a head start, not a gate. Measured on an Android emulator (Pixel 9 API 35), 6-step flow against a fast app, runs interleaved with the released build to cancel out host-load drift: baseline (sleep) 6.72s 6.79s 6.68s this change 5.27s 5.39s 5.07s ~1.45s saved per launch, i.e. the sleep minus the ~50-100ms the first tree read costs. Same on iOS by construction; the win is per `launch:` step, so a flow that relaunches several times saves a multiple of it.