-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could threaded transpile-only be faster? #928
Labels
Comments
This gets more compelling with ESM modules (#1010) since they can be loaded async. As soon as we've parsed tsconfig, we can figure out if worker thread(s) are needed, then launch it/them. Config can be passed as a JSON object. For all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was thinking about worker_threads in node 11 and wondering if moving the ts-node compiler to a pool of worker threads would ever be faster in
transpile-only
mode. I'm not sure it's worth it, but I want to share my thoughts anyway.It'll need
--files
set to eagerly load files instead of waiting for arequire()
call. If the app loads its entire codebase at startup, then compilation ordering doesn't matter because you need to wait for every file. But if you're only loading a small subset of the codebase, ts-node's thread worker will somehow need to be smart about compiling the right files first. It could analyze the files it loads forimport
statements orrequire()
calls and prioritize those files for compilation next. I'm not sure how much of a performance boost you'd get, though.There's also the issue of moving the entirety if ts-node into the worker thread. Otherwise you have to load
typescript
into the main thread, which seems costly. But maybe not, since we have to wait for the worker to load it anyway?Hopefully some day I'll have a chance to prototype this and see if it's any faster.
The text was updated successfully, but these errors were encountered: