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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_T
# Remove the stuff we're clobbering.
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION

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


# Install from source with multiple make jobs (and swapped arg order)
nvm install -j ${NVM_MAKE_JOBS-:2} -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"

# Check
[ -d ../../$NVM_TEST_VERSION ]
Expand Down
Loading