Balance unit tests across multiple threads #18956
Merged
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.
Previously we just reserved one thread for unit tests; but they now take longer on their own than the average execution time of all the other threads - making them the critical path for testing. This change allows us to execute (and profile!) each suite separately; after an initial run to gather profiling data on the unit tests, this managed to bring my total runtime down by a few seconds (~6s-10s), and perhaps more importantly, exposes gems like this (numbers are
ms
):and in a second run, to show that these numbers seem somewhat consistent:
Our three longest-running test suites are unittest suites, and are recently modified/created. I was wondering why test time went up so much recently, and now I know why. 🐱 If I felt comfortable skipping them, I could save almost 2 minutes of total wall-clock time (dived across 8 threads - so likely ~13s of real time) just by skipping those tests.