Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: privatenumber/tsx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.22.5
Choose a base ref
...
head repository: privatenumber/tsx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.23.0
Choose a head ref
  • 4 commits
  • 23 files changed
  • 1 contributor

Commits on Jul 3, 2026

  1. Configuration menu
    Copy the full SHA
    51800ac View commit details
    Browse the repository at this point in the history
  2. feat: add multi-scenario startup benchmark suite

    ## Problem
    
    Investigating startup performance (e.g. #809) meant
    ad-hoc scripts, and a single blended timing number conflates Node's
    floor, tsx's hook-registration tax, resolution, and transform. There was
    no reusable way to isolate those or compare across tsx/Node versions at
    scale.
    
    ## Changes
    
    Adds `scripts/benchmark/` (`pnpm benchmark`) — a scenario-based startup
    benchmark.
    
    - **Scenarios** isolate distinct costs: `node-baseline` (floor),
    `hooks-passthrough` (registration + pass-through, zero transforms),
    `esm-ts` (transform + resolution), `cjs-require`, `cjs-interop` (the
    #809 surface), `native-ts` (Node's type-stripping floor).
    - **Axes**: `--compare` (npm version or path to a tsx checkout),
    `--node` (downloaded via get-node), `--scale` (module sweep → per-module
    cost + fixed startup tax), `--cold`, `--json`.
    - **Metrics**: wall (mean±stdev + min headline); RSS and a load/eval
    split recorded in `--json`.
    - The default set (`node-baseline`, `hooks-passthrough`, `esm-ts`,
    `native-ts`) is a data-driven high-signal subset — a full sweep found
    `cjs-require` low-signal and `cjs-interop` ~1.0 correlated with
    `hooks-passthrough` at fixed size, so both are opt-in. Rationale in
    `scripts/benchmark/README.md`.
    
    The `--node` axis cleanly A/Bs async `module.register()` (worker thread)
    vs sync `module.registerHooks()`; the boundary is documented in
    `notes/node/module-hooks.md` (privatenumber/tsx#145).
    
    Example (esm-ts, 1000 modules, Node 24.15.0, M5 Pro):
    
    ```
    [email protected]   600ms
    [email protected]   1906ms   (3.18x — the #809 regression, sync-hooks path)
    ```
    privatenumber authored Jul 3, 2026
    Configuration menu
    Copy the full SHA
    c178197 View commit details
    Browse the repository at this point in the history
  3. fix: avoid redundant filesystem probes during module resolution

    Fixes #809
    
    ## Problem
    
    Since v4.21.1, projects with many local imports start 2–4x slower.
    Resolving a TypeScript specifier generated doomed extension candidates
    (e.g. `./file.ts` → `file.ts.ts`) and probed each one; every miss
    triggered a full failed resolution plus Node's eager CommonJS-hint
    decoration, which re-enters tsx's patched CJS resolver. The sync-hooks
    path (v4.21.1+, Node ≥24.11.1) runs that cascade on the main thread.
    
    ## Changes
    
    - `mapTsExtensions()` no longer generates guaranteed-miss candidates:
    verbatim TS extensions (`.ts`/`.tsx`/`.mts`/`.cts`) resolve as-is, and
    swap-list extensions (`.js`/`.jsx`/`.cjs`/`.mjs`) drop
    appended-extension guesses. Extension-less specifiers still search.
    - ESM and CJS resolvers skip candidates that provably don't exist (one
    `existsSync`) instead of a full failed resolution + error decoration.
    
    Resolution results are unchanged except for pathological
    doubled-extension files (`x.js.ts`), aligning tsx with esbuild/tsc.
    Covered by `tests/specs/resolution-priority.ts`.
    
    esm-ts benchmark, 1000 modules (Node 24.15, M5 Pro): this PR 804ms vs
    4.21.0 1412ms vs 4.21.1 3775ms.
    privatenumber authored Jul 3, 2026
    Configuration menu
    Copy the full SHA
    257bbbb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1dfad37 View commit details
    Browse the repository at this point in the history
Loading