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

Replace filtery with a strategy for implementation of proptest::Arbitrary #659

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

uzytkownik
Copy link
Contributor

Currently the proptest::Arbitrary implementation uses filter_map with failure rate of ~90%. This causes problems if user need to filter it further.

This change replaces it with using a range removing backtracing.

@paupino
Copy link
Owner

paupino commented Jul 11, 2024

Thank you for this!

For context for those looking into this - the previous implementation was generating a random number for scale however discarding most of them. This is quite inefficient - this updated implementation instead places a range on scale generation so that it can succeed without having to discard items.

@paupino paupino merged commit 6f8b0ae into paupino:master Jul 11, 2024
15 checks passed
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