-
Notifications
You must be signed in to change notification settings - Fork 230
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
Performance idea: --sf
/--slow-first
option to improve resource utilization
#657
Comments
That is indeed interesting. One detail however is that this doesn't need to be implemented in xdist at all, any plugin which reorders tests using |
It could be implemented elsewhere, but the For example, take a test suite with five 1s tests in file A, a single 3s test in file B, and two 3s tests in file C; and assume that we have two cores.
So on this toy model we get a 16% wall-clock speedup just from better task ordering! In the real world, I have twelve cores and Hypothesis' 2500 |
That link is 404 now. The original title was Running three hours of Ruby tests in under three minutes I believe?! |
My attempt to implement sorting using the previous run duration: |
Awesome @klimkin, thanks for sharing! |
is it possible to implement the sorting defined by pytest.mark.order(n) (from the pytest-order library)? |
I was looking for this feature and at using |
Reading this blog post about Stripe's test runner made me think we should have a
--slow-first
option for xdist, and it seems that we don't yet 😅 The motivation for--slow-first
is that fastest-tests-last is a great heuristic to reduce the duration at the end of a test run when some processes are done but others are still running - which can range from negligible to "several times longer than the rest of the run" (when e.g. I select mostly fast unit tests, plus a few slow integration tests which happen to run last).IMO this should be lower priority than
--last-failed
, only reorder passing tests for--failed-first
, and be incompatible with--new-first
(existing flag docs). The main trick is to cache durations from the last run, and then order by the aggregate time for each loadscope (i.e. method, class, or file, depending on what we'll distribute - pytest-randomly is useful prior art).The text was updated successfully, but these errors were encountered: