File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,22 +249,24 @@ const measureStreamReply = Effect.fn("measure.streamReply")(function* (
249249 return { report, stillStreaming : streamingItem ( after ) !== undefined } ;
250250} , Effect . scoped ) ;
251251
252- /** Opens a screen from Home and records its mount and data settling. */
252+ /** Opens a screen from a freshly loaded Home and records its mount and data settling. */
253253const measureRouteOpen = Effect . fn ( "measure.routeOpen" ) ( function * (
254254 options : Options ,
255255 route : string ,
256256 run : number ,
257257) {
258+ // A link to an already-open screen only refocuses it, so each run starts from a reload.
259+ yield * Effect . scoped (
260+ Effect . flatMap ( connectInspector ( options . metro ) , ( evaluate ) =>
261+ evaluate ( "__t3RenderCounterReload()" ) ,
262+ ) ,
263+ ) ;
264+ yield * Effect . sleep ( "15 seconds" ) ;
258265 const evaluate = yield * connectInspector ( options . metro ) ;
259- const open = ( path : string ) =>
260- evaluate (
261- `__t3RenderCounterOpen(${ encodeJson ( `${ options . scheme } ://${ path . replace ( / ^ \/ / , "" ) } ` ) } )` ,
262- ) ;
263- // Each run mounts the screen fresh rather than refocusing the previous one.
264- yield * open ( "" ) ;
265- yield * Effect . sleep ( "3 seconds" ) ;
266266 yield * evaluate ( "__t3RenderCounterStart()" ) ;
267- yield * open ( route ) ;
267+ yield * evaluate (
268+ `__t3RenderCounterOpen(${ encodeJson ( `${ options . scheme } ://${ route . replace ( / ^ \/ / , "" ) } ` ) } )` ,
269+ ) ;
268270 yield * Effect . sleep ( `${ options . windowSeconds } seconds` ) ;
269271 const report = yield * decodeReport ( yield * evaluate ( "JSON.stringify(__t3RenderCounterStop())" ) ) ;
270272 if ( report . commits === 0 )
Original file line number Diff line number Diff line change @@ -151,6 +151,12 @@ Object.assign(globalThis, {
151151 void Linking . openURL ( url ) ;
152152 return true ;
153153 } ,
154+ /** Restarts the JS app on Home; deferred so the inspector call can reply first. */
155+ __t3RenderCounterReload ( ) {
156+ const { DevSettings } = require ( "react-native" ) as typeof import ( "react-native" ) ;
157+ setTimeout ( ( ) => DevSettings . reload ( ) , 100 ) ;
158+ return true ;
159+ } ,
154160 __t3RenderCounterStart ( ) {
155161 state . commits = 0 ;
156162 state . counts = new Map ( ) ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ node apps/mobile/scripts/measure-renders.mts --server <server-origin> --token <t
5858 --metro http://< metro-lan-host> :8081 --project-root < scratch-dir>
5959```
6060
61- ` --route /settings/usage ` instead opens that app path from Home and records a 6 s window over
61+ ` --route /settings/usage ` instead reloads the app, opens that path from Home and records a 6 s window over
6262mount and data settling, with no provider turn and no ` --server ` , ` --token ` or ` --project-root ` .
6363
6464Compare before and after on the same base, on the same device, with the median of three runs.
You can’t perform that action at this time.
0 commit comments