$ the-wire · showcase
cjs-module-lexer scans faster, ffi throws on missing args
By RepoJournal · Filed · About Node.js
Undici updates to 8.10.2 while cjs-module-lexer cuts parsing time by over 13% and ffi helpers now throw instead of silently returning undefined.
nodejs/node updated undici to 8.10.2 [1], an automated dependency bump that brings the latest fixes to Node's HTTP client. Alongside it, two test changes stabilize the watch and WASI pthread suites, addressing flaky failures caused by race conditions in fixture setup.
In cjs-module-lexer, a new optimized path skips runs of identifiers and numbers [3], cutting JS parsing from 12,799.70 to 11,094.91 µs per sweep and Wasm from 14,187.29 to 11,671.96 µs on a 3,629,072-code-unit corpus. A separate optimization speeds up UTF-16 source copies [4], improving from 13,921.11 to 10,368.47 µs per sweep. Both changes rely on a fresh process benchmark, and the optimized Wasm grows by only 154 bytes.
Node's experimental ffi module now throws when a required argument is omitted [2]. Previously, all 22 helpers (ffi.getInt8() through ffi.getFloat64(), ffi.toBuffer(), etc.) returned undefined on missing arguments, making silent no-ops indistinguishable from reading a zero byte. Now they throw consistently with GetValidatedPointerAddress() and GetValidatedSize().
changelog-maker 5.0.1 replaces the tap test runner with Node.js's built-in test runner [5], and nodejs-dist-indexer 1.8.25 bumps bl from 7.0.11 to 7.0.12 [6].
Action items
- → Check for ffi usage in code that may omit arguments; update to handle new exceptions before upgrading Node nodejs/node [plan]
- → Consider benchmarking cjs-module-lexer; the new skip-run optimization may speed up your module loading nodejs/cjs-module-lexer [plan]
- → No action needed for undici 8.10.2 unless you vendor it; test suites are stable now nodejs/node [monitor]
References
- [1] deps: update undici to 8.10.2 ↗ nodejs/node
- [2] ffi: throw on missing memory helper arguments ↗ nodejs/node
- [3] perf: skip identifier and number runs ↗ nodejs/cjs-module-lexer
- [4] perf: speed up UTF-16 source copies ↗ nodejs/cjs-module-lexer
- [5] test: replace tap with Node.js test runner ↗ nodejs/changelog-maker
- [6] chore(release): 1.8.25 [skip ci] ↗ nodejs/nodejs-dist-indexer