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

[Tests] Try to detect & use more threads in local #1499

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PeterDaveHello
Copy link
Collaborator

No description provided.

# 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
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

@PeterDaveHello PeterDaveHello Apr 14, 2017

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 ljharb added the testing Stuff related to testing nvm itself. label Apr 12, 2017
@PeterDaveHello
Copy link
Collaborator Author

@ljharb is there anything else I can do here? Thanks.

@ljharb
Copy link
Member

ljharb commented Jun 26, 2017

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).

@PeterDaveHello
Copy link
Collaborator Author

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!

@PeterDaveHello
Copy link
Collaborator Author

@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.
Thanks for your time.

@ljharb ljharb force-pushed the speedup-install-from-src-thread-test branch from ee53d2a to e87ec0c Compare December 5, 2023 05:17
@ljharb ljharb force-pushed the master branch 2 times, most recently from c6cfc3a to c20db2a Compare June 10, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Stuff related to testing nvm itself.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants