BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

Support for 9, 10, 11, 12 tuples accounts for 35% of the compile time of the crate #146

Closed bluss closed 7 years ago

bluss commented 8 years ago

Support for 9, 10, 11, 12 tuples accounts for half of the compile time of the crate.

Diminishing returns. I would kill these off.

bluss commented 8 years ago

code diff:

diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 422c07d..8fb836c 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -192,14 +192,6 @@ impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
                     (g, G));
 impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
                     (g, G), (h, H));
-impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
-                    (g, G), (h, H), (i, I));
-impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
-                    (g, G), (h, H), (i, I), (j, J));
-impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
-                    (g, G), (h, H), (i, I), (j, J), (k, K));
-impl_arb_for_tuple!((a, A), (b, B), (c, C), (d, D), (e, E), (f, F),
-                    (g, G), (h, H), (i, I), (j, J), (k, K), (l, L));

 impl<A: Arbitrary> Arbitrary for Vec<A> {
     fn arbitrary<G: Gen>(g: &mut G) -> Vec<A> {
diff --git a/src/tester.rs b/src/tester.rs
index 8fed5b9..d6fe5ad 100644
--- a/src/tester.rs
+++ b/src/tester.rs
@@ -311,10 +311,6 @@ testable_fn!(A, B, C, D, E);
 testable_fn!(A, B, C, D, E, F);
 testable_fn!(A, B, C, D, E, F, G);
 testable_fn!(A, B, C, D, E, F, G, H);
-testable_fn!(A, B, C, D, E, F, G, H, I);
-testable_fn!(A, B, C, D, E, F, G, H, I, J);
-testable_fn!(A, B, C, D, E, F, G, H, I, J, K);
-testable_fn!(A, B, C, D, E, F, G, H, I, J, K, L);

 fn safe<T, F>(fun: F) -> Result<T, String>
         where F: FnOnce() -> T, F: Send + 'static, T: Send + 'static {

(So it's only 35% of the time, not half).

time passes diff: https://www.diffchecker.com/KwZzzzDK

eddyb commented 8 years ago

Going from 8 to 12 tuples, the number of MIR definitions (which is correlated with typeck work) doubles. You can see that most of them are from format string statics: https://www.diffchecker.com/GPa7kXr9.

BurntSushi commented 7 years ago

I'd be fine with this.

bluss commented 7 years ago

Thank you