Use --parallel when running tests on CI and in precommit#2666
Merged
niklasmohrin merged 4 commits intoe-valuation:mainfrom Apr 13, 2026
Merged
Use --parallel when running tests on CI and in precommit#2666niklasmohrin merged 4 commits intoe-valuation:mainfrom
niklasmohrin merged 4 commits intoe-valuation:mainfrom
Conversation
On my machine, wall clock time for "./manage.py run test" drops from 43 to 20s with 6 threads. More threads increased the overhead for creating databases more than it reduced the time for the actual tests. The github runners only have 4 cores.
56f709a to
75696fc
Compare
374970c to
e228804
Compare
richardebeling
approved these changes
Mar 9, 2026
niklasmohrin
reviewed
Mar 9, 2026
Collaborator
Author
|
I put a hardcoded value there because on my machine with a i7-13800H (6 P-cores with hyperthreadig, 8 E-cores) it would start 20 processes and actually run quite a bit slower while burning much more CPU cycles than with 6 processes. When I opened the PR I thought 6 was an "organic" sweet spot based on my measurements, but it's suspiciously equal to the number of P-cores :) I would still think that in the absence of a percentage option a hardcoded 4-8 would be better for most, but I don't mind much. Feel free to edit the PR and merge it :)
…On March 11, 2026 12:15:24 PM GMT+01:00, Richard Ebeling ***@***.***> wrote:
@richardebeling commented on this pull request.
> @@ -43,7 +45,7 @@ jobs:
start-db: true
- name: Run tests
- run: python manage.py test --shuffle
+ run: python manage.py test --shuffle --parallel 4
Django can only do "auto", anything else would require code from us. I think "auto" will be fine, even for the weaker laptops. Note that this is only `precommit`. For `test`, we don't change the default.
--
Reply to this email directly or view it on GitHub:
#2666 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
Users who would like to override the parallelism can set the environment variable DJANGO_TEST_PROCESSES.
richardebeling
approved these changes
Apr 6, 2026
Member
richardebeling
left a comment
There was a problem hiding this comment.
Updated everything to use auto detection. For environments where this is not appropriate, users can set the DJANGO_TESTS_PROCESSES environment variable to override the auto choice. I think this is a reasonable compromise.
niklasmohrin
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On my machine, wall clock time for "./manage.py run test" drops from 43 to 20s with 6 threads. More threads increased the overhead for creating databases more than it reduced the time for the actual tests. The github runners only have 4 cores.