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

Improve --watch mode performance #31

Open
mpizenberg opened this issue Dec 20, 2020 · 5 comments
Open

Improve --watch mode performance #31

mpizenberg opened this issue Dec 20, 2020 · 5 comments

Comments

@mpizenberg
Copy link
Owner

Currently, the --watch mode re-run everything. This is a simple but very useful strategy. Few improvements may come to mind.

  1. Only rerun tests potentially impacted by the change
  2. Avoid re-launching a Node.js instance for the supervisor

(1) is quite complicated since it involves analyzing the modules dependency graph to know which tests might need to be re-run.

(2) could be achieved without too much trouble I believe. It would just require not exiting the supervisor when the run ended if we are in watch mode. The supervisor is already capable of restarting the runners when it receives the paths to a runner file via stdin.

@BrianHicks
Copy link
Contributor

the first is not awful, actually! I've got a script that does it for me (although it depends on private code, so I can't just give it to you.) I've made steps towards publishing it, though—the first is https://git.bytes.zone/brian/tree-grepper. With that, you can query for (say) the module name and all imports in each file, then make a mapping from the module names to their paths by examining source-directories in elm.json. At that point, the tests to run are just all the test-containing nodes reachable from the changed file.

Since this is a Rust project, it's pretty easy to pull in tree-sitter. That means it would be possible to do this without any external program calls!

@mpizenberg
Copy link
Owner Author

We used to pull tree-sitter but we're not anymore. It contains C++ code and was impossible to compile with musl unfortunately despite quite some energy spent by Harry trying. So I guess this will eventually need some new code but I'm hopeful a motivated contributor will show up :)

@BrianHicks
Copy link
Contributor

oh, that's interesting. Why does this project need to be compiled with musl?

@mpizenberg
Copy link
Owner Author

Having a single binary for linux is something dear to me. I'm too often annoyed by projects compiled in ubuntu and not working on arch or the reverse.

@harrysarson
Copy link
Collaborator

See avh4/elm-format#709 for a motivating example

@mpizenberg mpizenberg changed the title Improve --watch mode Improve --watch mode performance Feb 15, 2021
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

3 participants