nub is slow then ts-node. #749
NarHakobyan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I've tested nub on our nestjs project, it the startup of nub went up from 5s to 15s.
Plain TS: nub wins. Add decorators and it inverts and goes linear at ~9 ms/file vs ts-node's ~1 ms. Profiling the decorator-only case gives the same shape as the real run (87.1% in resolveSpec). Reason: nub's transformer emits @oxc-project/runtime/helpers/decorate / decorateMetadata / decorateParam — 2929 of 6331 cached outputs on this machine import them — roughly three extra import sites per decorated class. That's every file in a Nest codebase. ts-node sidesteps it entirely with require.extensions['.ts']: plain CJS resolution, no path↔URL round trip, and tsc emits decorator metadata inline.
Then watch mode multiplies it
nub --watch is Node's native --watch (its own Restarting 'src/…' output) — full respawn, nothing carried in memory, so every edit repays the whole ~10 s. ts-node-dev --respawn restarts only the child; measured restarts were 697 ms and 1151 ms against its own 2446 ms cold start, consistent with compilation state being reused.
All reactions