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

Replaced calls to Range.exponential with Range.constant to avoid issue #237 #240

Merged

Conversation

TysonMN
Copy link
Member

@TysonMN TysonMN commented Jun 30, 2020

Replacing calls to Range.exponential with Range.constant seems like an easy way to avoid issue #237. For this branch, all the tests pass on my machine, which is using MSBuild 16.6.0. Since AppVeyor is still using version 16.5.0, I expect all tests to pass for both the current state of master as well as for this branch.

I am not confident in my understanding of the difference between Range.exponential and Range.constant.

Does Range.constant x y model the (discrete or continuous) uniform distribution and Range.exponential model either the (discrete) geometric distribution or the (continuous) exponential distribution?

@cmeeren
Copy link
Member

cmeeren commented Jun 30, 2020

This is better asked in the Hedgehog repo. Range.constant is, as the name implies, constant (i.e. any test in the run, whether the first or last test, has an equal chance of picking any value from the range, whereas for Range.exponential, early tests in the run will pick values closer to the range's "zero" the later tests will pick values from the whole range, and the "amount of values" available to be picked from increases exponentially with the test repeat number. In other words, compared to Range.linear, Range.exponential will pick more "low" values. This increases performance if used as the size for lists etc., because there's less data to generate.

@cmeeren
Copy link
Member

cmeeren commented Jun 30, 2020

If the switch from Range.exponential to Range.constant fixes a MissingMethodException, then that should probably be reported as a bug in the Hedgehog repo.

@TysonMN
Copy link
Member Author

TysonMN commented Jun 30, 2020

I have reported the issue to Hedgehog here. In the meantime, let's go with the workaround in this PR.

This increases performance if used as the size for lists etc., because there's less data to generate.

With this change to use Range.constant, I can run all our tests on my machine in less than 22 seconds. So if it really is just a performance consideration, then I think we can also stick with this workaround forever.

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