Files
Divy Srivastava ef992098c9 perf: startup profiling instrumentation + clap fast-path (#35263)
Split out of #34450 (the lazy-load startup PR) per review feedback —
both pieces are independent of the lazy-load work and reviewed more
easily on their own.

### 1. Startup-phase profiling

Gated on `DENO_STARTUP_PHASES` (zero cost when unset). `boot_phase`
markers in `cli/lib.rs` + `cli/tools/run/mod.rs` and `startup_phase_*`
markers in `libs/core/runtime/jsruntime.rs` attribute the cold-start
budget across spawn / V8-init / snapshot-deser / bootstrap / run. Adds a
`cli/examples/startup_bench.rs` harness.

```
DENO_STARTUP_PHASES=1 deno run empty.js
```

### 2. clap fast-path for bare `deno run <file>`

When no deno-level flag precedes the script, skip building the full clap
command tree (~5.5ms cold / ~0.7ms warm) and construct the `Run` flags
directly. Any flag before the script (`-A`, `--allow-net`, …) falls back
to the normal parser, so behavior is unchanged.

Profiling (warm, `run --no-remote`, forces full parser): `clap_root()`
build ~0.23ms, `try_get_matches` parse ~0.48ms — the fast-path skips
both.

Both were originally part of #34450; moved here so that PR stays focused
on the lazy-load change.
2026-06-16 15:02:13 +02:00
..