What happened?
With PI_TIMING=1, the readPipedStdin timing marker reports ~9s, but the actual stdin read takes <1ms. The marker is placed after await createAgentSessionRuntime(...), so the runtime creation time leaks into the readPipedStdin measurement.
time("createRuntime");
const runtime = await createAgentSessionRuntime(createRuntime, { ... }); // ← heavy work goes here
// ...
stdinContent = await readPipedStdin();
time("readPipedStdin"); // ← includes everything since the previous time() call
Steps to reproduce
PI_TIMING=1 PI_STARTUP_BENCHMARK=1 pi
Observe that readPipedStdin dominates the timing output, while there is no separate entry for createAgentSessionRuntime.
Expected behavior
createAgentSessionRuntime should have its own timing entry so the real bottleneck is visible. Adding a time("createAgentSessionRuntime") right after the call resolves this.
time("createRuntime");
const runtime = await createAgentSessionRuntime(createRuntime, { ... });
time("createAgentSessionRuntime"); // ← add this
// ...
stdinContent = await readPipedStdin();
time("readPipedStdin");
Version
0.75.4
What happened?
With
PI_TIMING=1, thereadPipedStdintiming marker reports ~9s, but the actual stdin read takes <1ms. The marker is placed afterawait createAgentSessionRuntime(...), so the runtime creation time leaks into thereadPipedStdinmeasurement.Steps to reproduce
Observe that
readPipedStdindominates the timing output, while there is no separate entry forcreateAgentSessionRuntime.Expected behavior
createAgentSessionRuntimeshould have its own timing entry so the real bottleneck is visible. Adding atime("createAgentSessionRuntime")right after the call resolves this.Version
0.75.4