Skip to content
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

Remove some problematic shrinker passes #461

Merged
merged 4 commits into from
Feb 16, 2017

Conversation

DRMacIver
Copy link
Member

This removes two passes from the shrinker:

  • the ddsub pass in the lexicographic minimizer that subtracted 1 from each byte
  • the interval replacement pass

These turn out to be the source of at least one flaky test in test_example_quality (the large union test) - both of them would occasionally get stuck there and produce bad shrinks:

  • In the ddsub pass it would suffer from a problem of too many shrinks - it would perform a lot of small shrinks instead of the more desirable few numbers of large shrinks.
  • the interval replacement pass was largely useless for this test but still ended up taking up a lot of time

Moreover both of these passes appear to be unneeded. The ddsub pass is mostly redundant with the later attempts to shrink individual indices, which work better because they tend to go straight for a larger shrink by starting from close to 0.

I'm not sure why the interval replacement pass is now unneeded, but all the example quality tests pass without it. It seems to be the result of improvements in the rest of the shrinker now making it largely redundant.

@DRMacIver
Copy link
Member Author

Hmm. Looks like there are a bunch of shrink quality checks elsewhere that raise problems with this. I'll tinker with this further.

The later per index shrinks can achieve the main purpose of this
shrink (subtracting one from individual values) but are less likely
to get stuck in the problem of repeatedly performing small shrinks
because they try shrinking to smaller values first.
This no longer seems to be needed (I'm not sure why - some other
changes to the minimizer seem to have supplanted it) to pass the
example quality tests, and it's quite an expensive pass which
usually doesn't work, so let's just remove it.
This test only existed to trigger the interval replacement
code more reliably because it was hard to come up with a direct
example that did.
This basically does a partial insertion sort on blocks of the same
length, moving cheaper blocks earlier in the process. This helps to
achieve a canonical result rather than the messier ones we might
otherwise get.

This is something I tried before but wasn't useful then. It is now
- the interval replacement largely did the job that this is now doing,
but more expensively.
@DRMacIver DRMacIver force-pushed the DRMacIver/harden-large-union-test branch from 79b7fe6 to 4342e8c Compare February 15, 2017 17:26
Copy link
Contributor

@alexwlchan alexwlchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Merge away, unless there’s some more work you’d like to do here.

@DRMacIver DRMacIver merged commit 6d3019a into master Feb 16, 2017
@DRMacIver DRMacIver deleted the DRMacIver/harden-large-union-test branch February 16, 2017 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants