Startup and Bridge Calls

Startup Time, Bundling and Reducing Bridge Calls

Startup has three stages: Android launches the activity, the WebView loads index.html and its scripts, and deviceready waits for every plugin (Architectural Limits). Measure them with adb shell am start -W (Running on the Emulator) and performance.now() at deviceready (deviceready), then remove unused plugins, bundle and minify scripts with a tool such as esbuild 126 , and defer network work until the first screen shows.

Each bridge call costs time too, because arguments and results travel as JSON strings between threads:

Timing bridge round trips, one after another and all at onceJavaScript
const perCall = (t0) => Math.round((performance.now() - t0) * 10) / 1000;   // ms per call
let t0 = performance.now();
for (let i = 0; i < 100; i++) await BookNest.info();
const sequential = perCall(t0);
t0 = performance.now();
await Promise.all(Array.from({ length: 100 }, () => BookNest.info()));
const concurrent = perCall(t0);
t0 = performance.now();
for (let i = 0; i < 100; i++) JSON.parse(JSON.stringify({ fontScale: 1, sdkInt: 36 }));
({ sequential, concurrent, inPage: perCall(t0) });
Output
{ sequential: 10.845, concurrent: 2.416, inPage: 0.001 }

Figures are milliseconds per call on the busy emulator. A round trip cost about 11 ms when each call waited for the previous one, under a quarter of that when all 100 were in flight together, and a microsecond without the bridge. Cache results that do not change, such as info, send one call with an array instead of many calls, and keep the bridge out of scroll and animation handlers.