-
Notifications
You must be signed in to change notification settings - Fork 174
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
Default SizeRange too large #320
Comments
I have no objections to configuring this via the environment. @matthew-russo @cameron1024 thoughts? |
Sorry for the delay in getting to this -- do you have an example of whats problematic? generating Vecs of specific lengths can just be done with
or with imports it cuts down to
which is pretty terse. the range could be extracted out in to a const so its not hardcoded everywhere as well. i get the feeling i'm not understanding part of this though |
Yep that's exactly the workaround to override default settings. I'll give an example from our codebase.
The default settings for us routinely lead to tests that spend majority of time in test-case-generation of large Vecs. I've seen such changes reduce individual test time from 20s to <1s w/ minimal impact to test quality (vec of 10 is plenty). We tend to use the default settings most of the time and override them when they are non-performant. It is particularly likely to become non-performant in a nested collection scenario (eg if the When I grep our codebase (100k loc) for this pattern, I found 32 instances of this sort of pattern, mostly from us whack-a-moling tests that are too slow with default settings. Many more don't use this pattern. (I count ~150 @matthew-russo is certainly right - we could do a pass over the codebase and train everyone (or build a sophisticated linter) to stick a Thanks for the work on maintaining the project! We're fans of randomized testing. |
Hi proptest community. I'm finding that the default size range of 0..100 is too large, and is ending up broadly taking up most of the time in our testsuite (generating collections).
Would proptest be amenable to making this default range something that's adjustable? I would probably set it to 10 or 20. Perhaps by environment variable. It would be nice to avoid littering the codebase with strategy overrides for basic
Vec
.https://docs.rs/proptest/latest/proptest/collection/struct.SizeRange.html
I am happy to submit a PR.
I'm also open to other solution ideas for this problem.
Thanks! Big fan
The text was updated successfully, but these errors were encountered: