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

Deque: Stack overflow when exceeding 17_000 elements #464

Open
luc-blaeser opened this issue Dec 16, 2022 · 0 comments
Open

Deque: Stack overflow when exceeding 17_000 elements #464

luc-blaeser opened this issue Dec 16, 2022 · 0 comments

Comments

@luc-blaeser
Copy link
Contributor

luc-blaeser commented Dec 16, 2022

The Deque implementation currently causes a stack overflow trap when using it at larger scale, e.g. by inserting more than 17_000 elements and then removing those from the other end of the deque.

Example of failure, by extending dequeTest.mo:

ignore Iter.toArray(iterateBackward(populateForward(1, 17_000)));

This is due to the internally used List.split() function that involves non-optimized tail recursion.

Related possible improvement for Deque:

  • Reduce runtime and space performance of push/pop functions to O(1) worst-case per single function call (by avoiding List-split implementation).
luc-blaeser added a commit that referenced this issue Jan 5, 2023
Improve `Deque.mo`:
* Documentation
* Unit tests

Issue detected while refactoring:
* #464

Possible improvement for `Deque`:
* Reduce runtime and space performance of push/pop functions to `O(1)` worst-case per single function call (by avoiding List-split implementation).
ggreif pushed a commit that referenced this issue Jan 5, 2023
Improve `Deque.mo`:
* Documentation
* Unit tests

Issue detected while refactoring:
* #464

Possible improvement for `Deque`:
* Reduce runtime and space performance of push/pop functions to `O(1)` worst-case per single function call (by avoiding List-split implementation).
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