RUST-580 Improve compile times of the test suite#412
RUST-580 Improve compile times of the test suite#412patrickfreed merged 1 commit intomongodb:masterfrom
Conversation
| fn execute_test_runner_operation<'a>( | ||
| &'a self, | ||
| _test_runner: &'a mut TestRunner, | ||
| ) -> BoxFuture<'a, ()> { |
There was a problem hiding this comment.
Does this (and likewise below) need a default body? It didn't have one before.
There was a problem hiding this comment.
They didn't have them previously because default implementations didn't place nicely with async_trait, see this comment for more info: https://github.com/mongodb/mongo-rust-driver/blob/master/src/test/spec/v2_runner/operation.rs#L43.
isabelatkinson
left a comment
There was a problem hiding this comment.
lgtm! this is awesome, these changes speed up compile time to ~10 seconds for me as well
NBSquare
left a comment
There was a problem hiding this comment.
This looks great. Based on the issue you linked it does seem like it's still worth investigating why async_trait causes this issue. Avoiding use of the trait definitely hurts the readability of the test code IMO.
|
Yeah definitely, I updated the original issue and also filed one on |
RUST-580
This PR reimplements the various test runner
TestOperationtraits manually rather than relying onasync_trait, resulting in much faster compile times of the tests. For context, see rust-lang/rust#87012 (comment).On my machine, an incremental change to
TestClient::new(e.g. adding a singleprintln!) used to take ~1m15s to runcargo check --tests, whereas the same change now takes ~10s. There's still a lot of room for improvement (such a change should ideally be near instant), but this is still a big difference.