Nested proptest!{}
's cause run time to rise exponentially
#437
Labels
help-request
This issue is asking for advice/help on using proptest
Due to how
proptest!{ |(... stats ...)| { ...} }
is implemented, it spawns new nested runner which in turn runs yet anothernum_cases
. Thus, with default number of cases being 256, one nestedproptest
would do 65536 runs, and double nested one would do 16777216 (!!!) runs.While I clearly understand why this happens, it was quite a surprise to me. I needed test which would perform nontrivial multistep initialization of certain engine, so I got 2 nested macros. And my test was running for like 246 seconds. When I replaced second nesting with smart-ish deduction of parameter I needed to generate, run time dropped from 246 to 3.7 seconds.
I see two problems here:
proptest! {}
is IMO not articulated at all. Or I miss that warning completely.Thoughts?
EDIT:
Maybe consider splitting
proptest!
macro into three? One creates outer runner and cannot be nested, another creates nested runner but does only single run (no exponent), third one behaves like old nested case?The text was updated successfully, but these errors were encountered: