-
Notifications
You must be signed in to change notification settings - Fork 37
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
Long integer shrinking from within toplevel/utop #59
Comments
I can reproduce, indeed (although on my linux computer the native version takes a few seconds, the stack might be bigger). In the normal toplevel it takes 387s to shrink. This is very puzzling and I doubt it's a qcheck bug in itself (the code is the same! I set a fixed random state just to be sure). Maybe it's a difference in stack size? |
I compiled with
|
Here's another experiment that may (or may not) cast light on the matter:
So searching (shrinking) for the minimal constant (209609) that disproves the property just takes an awful lot of shrinking steps (52578!) compared to the bytecode run (138) and native-code run (215). Doing x200 more shrinking steps is almost instant here (0.2s) but with a computationally more expensive property it will clearly be more costly. Finally,
which means we could investigate whether the built-in integer shrinker strategy can be revisited to better handle the present case. Orthogonally, it would also be nice to establish why the initial property is so expensive (stack overflow causing many expensive context switches?). |
I just merged #60, thanks to @Gbury. It does fix this issue, so maybe it was a problem of utop/toplevel having a slightly different stack size available, which lead to a bad path in integer shrinking. Integer shrinking tried |
This is very nice, although my brain hurts when trying to grasp the combination of recursive shrinker invocations and internal imperative state... :-D The patch indeed solves the above by bringing the property I also tried comparing the two shrinkers on the above three properties with the |
Consider the following code:
Assume you save the above to a file
bug.ml
.If I compile the example test with the bytecode backend I quickly (0.5s) find the bound (262049) for blowing the bytecode stack:
Similarly I can quickly (0.4s) find the bound (524115) for blowing the native-code stack:
However, if I try the same thing within the OCaml toplevel or utop -- I consistently get very long shrinking times (237.9s) with many (52578!) shrinking steps - to the point that I thought I had hit an infinite loop:
Is this example triggering a sore point in the built-in integer shrinker, or is something else going on?
This is on Mac OS X with OCaml 4.07.1 and QCheck 0.9.
The text was updated successfully, but these errors were encountered: