-
Notifications
You must be signed in to change notification settings - Fork 126
Add an upper bound on the number of test cases we run in parallel. #1390
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
base: main
Are you sure you want to change the base?
Conversation
This PR adds an upper bound, `NCORES * 2`, on the number of test cases we run in parallel. Depending on the exact nature of your tests, this can significantly reduce the maximum amount of dirty memory needed, but does not generally impact execution time. You can configure a different upper bound by setting the `"SWT_EXPERIMENTAL_MAXIMUM_PARALLELIZATION_WIDTH"` environment variable (look, naming is hard okay?)
| private var _continuations = [CheckedContinuation<Void, Never>]() | ||
|
|
||
| init(maximumWidth: Int = 1) { | ||
| self.maximumWidth = maximumWidth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we precondition on maximumWidth > 0 here? I think run blocks forever if the user sets a width of zero, so it doesn't really make sense to allow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eeeeh okay.
jerryjrchen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. The only concern I have is over the naming for Serializer
This PR adds an upper bound,
NCORES * 2, on the number of test cases we run in parallel. Depending on the exact nature of your tests, this can significantly reduce the maximum amount of dirty memory needed, but does not generally impact execution time.As an example, Swift Testing's own tests go from > 300MB max memory usage to around 60MB.
You can configure a different upper bound by setting the
"SWT_EXPERIMENTAL_MAXIMUM_PARALLELIZATION_WIDTH"environment variable (look, naming is hard okay?)Checklist: