Repository navigation
Commit f8992f1
authored
perf: use sync module hooks on Node v22.22.3+
## Problem
tsx uses the sync `module.registerHooks()` path (no loader worker
thread) only once Node can re-enter `Module._load` from sync hooks
([nodejs/node#59929](nodejs/node#59929)). That
landed in v24.11.1 / v25.1.0 and was **also backported to v22.22.3**,
but the gate had no 22.x entry — so v22.22.3+ kept taking the slower
async `module.register()` path.
## Changes
- Add `[22, 22, 3]` to the `moduleRegisterHooksCjsReload` gate. v22.22.2
and earlier stay on the async path; v22.22.3+ now uses sync hooks.
- Bump the 22.x CI matrix entry `22.22.2` → `22.22.3` so CI exercises
the newly-enabled sync path on the 22 line.
Verified the backport is behaviorally complete: the full suite (incl.
CJS-interop, `require.cache`, watch, version-sensitive) passes with Node
22.22.3 as the runner.
Startup on Node 22.22.3, 1000 modules (min of 6 runs, M5 Pro):
```
async (before) sync (this PR)
hooks-passthrough 437ms 190ms
esm-ts 694ms 337ms
```1 parent 1dfad37 commit f8992f1
2 files changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments