Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't suggest to start build with infinite number of threads#1087

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Delgan wants to merge1 commit intopython:mainfromDelgan:patch-1

Conversation

Delgan
Copy link

@DelganDelgan commentedApr 29, 2023
edited by github-actionsbot
Loading

Hi.

Just a small enhancement proposal, as I don't think callingmake with unbounded number of threads is desirable.

Usingmake -j will start "infinite" number of jobs according tomake docs, which slows down the build and consumes too many resources.

Suggestingmake -j4 seems to be a sane default, advanced users will know how to adjust it.


📚 Documentation preview 📚:https://cpython-devguide--1087.org.readthedocs.build/

@hugovk
Copy link
Member

Thanks for the suggestion.

What machine are you using? Does the build take longer withmake -j thanmake -j4, or otherwise slow the machine down? "consumes too many resources" - in what way?

On macOS with 8 CPUs,make -j uses them all and I don't notice any other slowdown. Having said that, it takes about the same time to run asmake -j4, around 32s.

@Delgan
Copy link
Author

Delgan commentedApr 29, 2023
edited
Loading

Hi@hugovk.

It's not so much related to my machine in particular. It's just that once all the CPU cores are used for compiling, adding more jobs generally do not improve the performance and rather tend to make it worst because of the overhead of context switches1. It's not very much noticeable in practice, though23.

However, what is growing continuously is the RAM consumption. Each started job will consume memory, which causes a noticeable increase in overall RAM usage (finally "wasted" since an infinite number of jobs cannot run in parallel). This is not really desirable, and this is frequently related to out-of-memory problems for a beginner who is not familiar withmake building process4.

Also I suggested-j4 but maybe-j2 is preferable as it matches the example given when clicking "more detailed instructions" on the page.

Footnotes

  1. Disadvantages to high make job values

  2. How to speed up compilation time in linux

  3. GNU make: should the number of jobs equal the number of CPU cores in a system?

  4. Ismake -j (with no argument) dangerous?

@terryjreedy
Copy link
Member

For the test suite, -j starts a number of parallel tests appropriate to the CPU. Since, you say, make -j does not do that, why not recommend -j# where # is appropriate for the machine?

@Delgan
Copy link
Author

@terryjreedy On the same page, tests are suggested to be run with./python -m test -j3, details about the-j argument are only provided onthe linked page. I suppose it's best to show a simple and functional example by default, and only go into detail on the appropriate page. It's easier to copy and paste. But in the end, it's up to what you prefer.

@willingcwillingc added the needs: decisionNeeds consensus decision from core devs labelOct 10, 2023
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@AA-Turner
Copy link
Member

AA-Turner commentedApr 18, 2025
edited by zware
Loading

Superseeded by either#1541 or#1543 or both.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
enhancementneeds: decisionNeeds consensus decision from core devs
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@Delgan@hugovk@terryjreedy@AA-Turner@willingc@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp