-
-
Notifications
You must be signed in to change notification settings - Fork 670
[Tests] Rewrite test runner in parallel & async way #825
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
Comments
Most time is spent in compiling and executing the modules, which is always synchronous, so using asynchronous APIs alone won't help much. What would work though is to spawn one process per CPU core and split up tests among these. For instance, spawn X child processes and make them request tests from the master when idle, run the test until idle again and request a new test, until all tests are done. Individual tests can still be synchronous then. |
Or use "worker_threads" which should be better I guess |
Or use isolation process for each test like in |
So I had a little go at writing some of the tests in paralell using Findings were that it saves off ~5 seconds when run in parallel across 12 cores, which was a bit disapointing (around 27 seconds instead of 32). Before:
After:
I doubt doing this for the One thing I did notice is that their is no abstractions for writing tests. It seems it might be useful to have some shared code that makes adding / removing tests simpler, which could be implemented in a way that allowed for an optional process oriented approach. Update: Bringing the number of workers down to 6 from 12 brought running town down to ~22 seconds :
10 seconds off the initial running time 🎉 |
I've taken this a step further and rewritten the three major test suites ( Before:
After:
I'll see if there's any more savings to be made here or better approaches to improve this further. |
Hmm, I see after slower then before. Is it correct? |
Not exactly (you can see the meaning of the times here: https://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1). The real amount of time is about 16 seconds faster after. |
I see. Great! |
Interesting that it becomes just a bit faster, though, even though it does significantly more work overall. May this have something to do with synchronous I/O blocking the entire cluster? Or does it do another spawn/fork per test it didn't do before or something like that? |
Closing this issue as part of 2020 vacuum because it seems to be sufficiently covered by the |
Currently most test routines run synchronously. But number of tests and files continiusly growing and this could be a problem in future.
Proposed steps:
glob.sync
->await glob
afterutil.promisify
or use tiny-glob / globby2) Switch fromWebAssembly.Instance
+WebAssembly.Module
toWebAssembly.instantiateStreaming
for instantiation.fs.readFileSync
->fs.readFile
,fs.writeFileSync
->fs.writeFile
The text was updated successfully, but these errors were encountered: