-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore old initial batch distribution logic in LoadScheduling (#812)
* Restore old initial batch distribution logic in LoadScheduling pytest orders tests for optimal sequential execution - i. e. avoiding unnecessary setup and teardown of fixtures. So executing tests in consecutive chunks is important for optimal performance. Commit 09d79ac optimized test distribution for the corner case, when the number of tests is less than 2 * number of nodes. At the same time, it made initial test distribution worse for all other cases. If some tests use some fixture, and these tests fit into the initial batch, the fixture will be created min(n_tests, n_workers) times, no matter how many other tests there are. With the old algorithm (before 09d79ac), if there are enough tests not using the fixture, the fixture was created only once. So restore the old behavior for typical cases where the number of tests is much greater than the number of workers (or, strictly speaking, when there are at least 2 tests for every node). In my test suite, where fixtures create Docker containers, this change reduces total run time by 10-15%. This is a partial revert of commit 09d79ac Co-authored-by: Bruno Oliveira <[email protected]>
- Loading branch information
1 parent
a1785b5
commit 80130d5
Showing
3 changed files
with
49 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Partially restore old initial batch distribution algorithm in ``LoadScheduling``. | ||
|
||
pytest orders tests for optimal sequential execution - i. e. avoiding | ||
unnecessary setup and teardown of fixtures. So executing tests in consecutive | ||
chunks is important for optimal performance. | ||
|
||
In v1.14, initial test distribution in ``LoadScheduling`` was changed to | ||
round-robin, optimized for the corner case, when the number of tests is less | ||
than ``2 * number of nodes``. At the same time, it became worse for all other | ||
cases. | ||
|
||
For example: if some tests use some "heavy" fixture, and these tests fit into | ||
the initial batch, with round-robin distribution the fixture will be created | ||
``min(n_tests, n_workers)`` times, no matter how many other tests there are. | ||
|
||
With the old algorithm (before v1.14), if there are enough tests not using | ||
the fixture, the fixture was created only once. | ||
|
||
So restore the old behavior for typical cases where the number of tests is | ||
much greater than the number of workers (or, strictly speaking, when there | ||
are at least 2 tests for every node). | ||
|
This file contains 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
This file contains 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