-
Notifications
You must be signed in to change notification settings - Fork 747
Run test in parallel batches #167
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
Run test in parallel batches #167
Conversation
I was having a try at implementing this, most of this code is new to me Follow review suggestion to use chunks to run test in parallel. To run with a different batch size: On my machine: |
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.
r=me with that, thanks so much for doing this!
|
||
let batch_size = env::var("BINDGEN_TEST_BATCH_SIZE") | ||
.ok() | ||
.map(|x| x.parse::<usize>().ok()) |
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.
nit: use and_then
here and you'll save the following unwrap_or(None)
.
.ok() | ||
.map(|x| x.parse::<usize>().ok()) | ||
.unwrap_or(None) | ||
.unwrap_or(16); |
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.
Could you move this number to a constant at the top of the file?
let passed = child.wait() | ||
.expect("Should wait on child process") | ||
.success(); | ||
|
||
if passed { None } else { Some((path, child)) } | ||
}) | ||
.collect(); | ||
}) | ||
.flat_map(|x| x ) |
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.
use flat_map
above (children.flat_map(
), and you can remove this line.
Follow review suggestion to use chunks to run test in parallel. Set default to 16 which works well even on my limited laptop, and which should benefit better machine. To run with a different batch size: BINDGEN_TEST_BATCH_SIZE=32 cargo test On my machine: 1 parallel test takes 3'53 2 parallel test takes 2'10 8 parallel test takes 2'08 32 parallel test takes 2'07
8a86e88
to
0762243
Compare
Thank you very much for your comments, they were very helpful. |
@bors-servo r=emilio |
📌 Commit 0762243 has been approved by |
Run test in parallel batches
☀️ Test successful - status-travis |
No description provided.