Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add guard against exponential time pathology #1082
Bad news: Hypothesis's shrinking is sometimes
(This isn't really a problem in practice because
Anyway, we can detect and fix some of the common cases as follows:
Important note: The lexical minimizer now has quadatic complexity in the size of its input. This mostly doesn't matter because the two cases where it gets used:
I do want to emphasise though that we are intrinsically doomed here. There is no non-exponential shrink algorithm that also produces good results. Something like the adversarially slow shrinker example we have in our test suite will for all intents and purposes always allow us force exponential slow downs.
So given that this PR is of somewhat questionable validity. My main arguments in favour of it are:
I ended up going with a completely different strict improvement on the status quo, but I'm now happy with this and think it's ready to review.