MCPcopy Create free account
hub / github.com/modem-dev/hunk / measureNavigation

Function measureNavigation

benchmarks/interaction-latency.ts:27–49  ·  view source on GitHub ↗

Measure `]` per-press latency plus memory ceilings on a fresh renderer.

()

Source from the content-addressed store, hash-verified

25
26/** Measure `]` per-press latency plus memory ceilings on a fresh renderer. */
27async function measureNavigation() {
28 const setup = await testRender(
29 React.createElement(AppHost, { bootstrap: createLargeSplitStreamBootstrap() }),
30 INTERACTION_VIEWPORT,
31 );
32
33 try {
34 const firstFrameStart = performance.now();
35 await renderPass(setup);
36 console.log(`METRIC first_frame_ms=${(performance.now() - firstFrameStart).toFixed(2)}`);
37 printMemoryMetrics("after_first_frame");
38
39 // Settle initial async work (selection reveal, highlight kick-off) so the
40 // press latencies measure navigation, not startup spillover.
41 await renderPass(setup, 2);
42
43 const pressLatencies = await measureKeyPressLatencies(setup, "]", NAVIGATION_PRESSES);
44 printLatencyMetrics("hunk_nav_press", pressLatencies);
45 printMemoryMetrics("after_navigation");
46 } finally {
47 await destroyRenderer(setup);
48 }
49}
50
51/** Measure per-scroll-tick latency on a fresh renderer (no navigation state). */
52async function measureScrolling() {

Callers 1

Calls 6

renderPassFunction · 0.90
printMemoryMetricsFunction · 0.90
measureKeyPressLatenciesFunction · 0.90
printLatencyMetricsFunction · 0.90
destroyRendererFunction · 0.90

Tested by

no test coverage detected