-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Tests] Try to detect & use more threads in local #1499
base: master
Are you sure you want to change the base?
[Tests] Try to detect & use more threads in local #1499
Conversation
# Install from source with 2 make jobs (and swapped arg order) | ||
nvm install -j 2 -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" | ||
# Speed up test for non-CI environment which may have more CPU threads | ||
[ -z "${CI-}"] && nvm_get_make_jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is "$CI" and where is it set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb it's set in Travis CI and most of the CI, as Travis CI will have 2 threads, by current detection wi won't use multi thread on CPU with only 2 threads, so need to exclude it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much speed gain does this provide? I'm not sure how important it is to make tests fast only in local dev, compared to the cost of having tests do different things in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends, it's more common to see 4~8 threads PC in the market, personally I'll use servers with more threads to do development works, actually I didn't really see a overhead for CI here, especially this part will finally be mocked in future, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is, it's a bad thing when tests do different things in different environments; it means local won't be an accurate predictor for CI, and vice versa.
Sometimes, a difference makes sense - mocking out data, or detecting hardware.
I'm asking what the speed difference is likely to be that warrants the difference between local and travis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 threads only:
real 19m13.364s
user 35m23.988s
sys 1m50.132s
16 threads:
real 4m18.194s
user 58m22.700s
sys 2m49.704s
5x times.
@ljharb is there anything else I can do here? Thanks. |
I'm basically just not convinced that the performance of local test runs is at all important compared to the complexity of deviating from travis (which is the source of truth). |
Basically it increased the complexity, that's true, but it'll help a lot to speed up the whole test process locally, especially the tests on local are not like the tests on Travis CI would be spreaded parallely, that's the point I think it'll help a lot! Please let me know if I need to close this PR or you'd like to have more discussion or you'd like to get it merged, thanks a lot! |
@ljharb do you have any further suggestions? I think once we figure out how to properly run all the tests locally, it'll help to speed a lot, especially many people have more than 2 or even 4 cores CPU right now. |
ee53d2a
to
e87ec0c
Compare
c6cfc3a
to
c20db2a
Compare
No description provided.