perf: collapse iOS simulator relaunch into one simctl launch call - #1024
Conversation
open --relaunch on a simulator dispatched close (simctl terminate, ~0.7s), settled 300ms, then dispatched open (simctl launch, ~0.8s). simctl launch --terminate-running-process does the whole relaunch in one call (~0.94s), so the fast path skips the close dispatch and the post-close settle: steady relaunch ~2.9s -> ~2.0s. The terminateRunningApp option threads from the open context through the interactor to buildIosSimulatorLaunchArgs; only the simulator bundle-id launch path consumes it. Runtime hints keep working - they are user-defaults writes read at the next launch, which the collapsed call still performs. --clear-app-state keeps the close-first ordering so it never mutates a running app's container; real devices and Android keep the two-step relaunch.
62e4792 to
e63d9d9
Compare
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Review finding: the collapsed simulator relaunch currently applies to any app-surface open with an open target, including valid |
Review finding: open <app> <url> --relaunch reached the collapsed fast path, but the URL dispatch branch never consumes terminateRunningApp - a deep-link open never launches the app, so there is nothing to attach the terminate to. The session layer skipped the close while the platform layer did not terminate either, silently losing relaunch semantics. The collapse now applies only to the single app-launch form (openPositionals.length === 1); URL relaunches keep the explicit close-then-open sequence, with a regression test.
|
Fixed in cf90009 — went with the restrict option. The collapse now requires Added the regression test: |
|
Summary
open --relaunchon a simulator dispatchedclose(simctl terminate, ~0.7s), settled 300ms, then dispatchedopen(simctl launch, ~0.8s).simctl launch --terminate-running-processdoes the whole relaunch in one ~0.94s call, so the simulator fast path skips the close dispatch and the post-close settle.Steady relaunch: ~2.9s → ~2.0s (iPhone 17 Pro sim, iOS 26.2; best steady sample 1.96s with
startup.durationMs879 — the dispatch itself got slightly longer since terminate now happens inside the launch call, while the total dropped).Mechanics
terminateRunningAppthreads from the open dispatch context throughInteractor.opentobuildIosSimulatorLaunchArgs; only the simulator bundle-id launch path consumes it. Real devices and Android keep the two-step relaunch (their close paths carry teardown semantics).defaults writevalues read at the next app launch, which the collapsed call still performs — verified the write-while-running ordering inruntime-hints.ts.--clear-app-statekeeps the close-first ordering: state clearing must never mutate a running app's container, so that flag opts out of the fast path.launchIosSimulatorAppretry policy (FBS launch errors) applies unchanged to the collapsed call.Validation
--clear-app-stateopt-out test.click @ref.