Repository navigation
[COLLECTIONS-722] Reuse the active path in nested iterator chains - #760
Closed
rishabhdaim wants to merge 1 commit into
Closed
rishabhdaim wants to merge 1 commit into
rishabhdaim wants to merge 1 commit into
Conversation
Retain the active path across values and keep removal delegated through the original iterators. Use the same traversal for lazily supplied iterators. Assisted-By: OpenAI Codex
Author
|
Superseded by #758, which now includes the iterator-chain changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nested
IteratorChains followed the full chain for every value. The iterator-of-iterators overload also ran out of stack on deeply nested inputs.Keep the path to the active iterator and reuse it until the source changes or a shared child is accessed independently. Use the same traversal for lazy sources. Keep the original delegation links for
remove(), including unmodifiable wrappers.A 50,000-layer chain returning 50,000 values timed out after five seconds with stack safety alone and passes with this change. The other regressions cover on-demand source access, lookahead after a shared child advances, and removal through two parents sharing a child.
The full Maven build passed on Java 21 with 22,549 tests reported, 82 skipped, and no failures.
JMH 1.37 on Java 21, building and draining a chain of 256 values
At 1,024 layers, allocation fell from 12.3 MB to 80.6 kB per operation. The one-layer case stayed at 96 B per operation.
COLLECTIONS-722. This complements #758, which covers chained iterable views. The active-path approach follows OAK-12558.
OpenAI Codex assisted with the implementation, tests, and benchmarks.