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

Improve shrinking long sequences #13

Closed
1Jajen1 opened this issue Oct 24, 2019 · 2 comments
Closed

Improve shrinking long sequences #13

1Jajen1 opened this issue Oct 24, 2019 · 2 comments

Comments

@1Jajen1
Copy link
Owner

1Jajen1 commented Oct 24, 2019

Shrinking always terminates if implemented correctly, but in the meantime due to missing lazyness very large lists will be generated and sometimes even retained in memory. The worst offender here is shrinkList, it would be much better if it operated on the Sequence data-type and only forced loading the entire thing if it's needed (when the list cannot be cut down to smaller sizes anymore, or that cutting had no effect). This is not an easy task because the implicit strictness of everything in kotlin makes for some fun situations (for example m(): Sequence is not lazy in generation, but sequenceOf(Unit).flatMap(m) is) It is quite tricky to find all of those situations, but it needs to be done to get shrinking back to a performant level on large sequences.

@1Jajen1
Copy link
Owner Author

1Jajen1 commented Oct 24, 2019

On second thought: Changing shrinkList to Sequence might not help as much (since we need the lists size, hence the full list) but something that definitly helps is lazy creation of smaller lists (currently the result is built up non-lazy for chunked lists).

@1Jajen1
Copy link
Owner Author

1Jajen1 commented Oct 24, 2019

Fixed by #16 albeit in an ugly way

@1Jajen1 1Jajen1 closed this as completed Oct 24, 2019
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

No branches or pull requests

1 participant