Skip to content
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

Performance - what's the reason behind reinitialising watcher on every restart? #308

Open
koniferous22 opened this issue Apr 24, 2022 · 1 comment

Comments

@koniferous22
Copy link

koniferous22 commented Apr 24, 2022

Issue description

I've been dealing with ts-node-dev restart on file change that takes about 25sec (larger codebase). Note that compiled directory in /tmp filesystem, should be initialized, so at this point minimum transpilation should take place. In such case the limiting factor seem to be emitted events, from patched require.

Screenshot 2022-04-24 at 23 36 00

After debugging transpiled code from node_modules with snippet above (transpiled hook.ts - section where callback is fired)
ts-node-dev on each restart fires in my case about 2500 {required: "filename.ts"} events. However the sole purpose of the events seems to just initialize watcher, that also gets destroyed before each restart.

ts-node-dev/src/index.ts

Lines 251 to 252 in f0c3e7e

watcher.close()
watcher = initWatcher()

Tried removing it from the restart function, worked fine on my workstation & worked with TS errors. So just wanted to double check if there's something.

Context

OS version (is it docker or host?), ts-node-dev version
Host - Apple M1 macOS Monterey, 1.18

Did you try to run with ts-node?
Yes

Did you try to run with --files option enabled?
Yes

Did you try to run with --debug option enabled?
Yes

Do you have a repro example (git repo) with simple steps to reproduce your problem?
No

@vantaboard
Copy link

That is the ugliest font I have ever seen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants