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

Resolve stack overflow in SortedSet.reduce and reduceRight #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alex-dunn
Copy link

closes #150, Resolve stack overflow for SortedSet reduce & reduceRight

Replace recursive implementation with version that uses the Iterator. The limit in size of the set now seems to be whenever the browser runs out of memory to allocate for the main tree + the history tree in splay.
Updated the Iterator to take a 4th argument: reverse. If reverse is falsey then behaviour is the same as master, otherwise it will iterator through the set in the reverse order.

Replace implementations of SortedSet.reduce and reduceRight.
Current implementations are recursive and so will inevitably
hit a stack overflow exception at some point.
New implementations use the Iterator to traverse the tree.
@hthetiot hthetiot requested a review from marchant August 12, 2021 11:14
@hthetiot hthetiot added the bug label Aug 12, 2021
@hthetiot
Copy link
Contributor

Possible duplicate 85f00f8

@hthetiot
Copy link
Contributor

Fix confirmed on master via this comment #241 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SortedMap.forEach throws RangeError when > 10000 items in map
2 participants