rishabhdaim opened a new pull request, #760:
URL: https://github.com/apache/commons-collections/pull/760

   Nested `IteratorChain`s 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
   
   | Layers | Stack-safe baseline | This patch | Oak |
   | ---: | ---: | ---: | ---: |
   | 1 | 0.90 µs | 1.08 µs | 0.74 µs |
   | 8 | 34.6 µs | 2.65 µs | 1.15 µs |
   | 1,024 | 6.14 ms | 16.8 µs | 25.0 µs |
   
   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](https://issues.apache.org/jira/browse/COLLECTIONS-722). 
This complements #758, which covers chained iterable views. The active-path 
approach follows [OAK-12558](https://issues.apache.org/jira/browse/OAK-12558).
   
   OpenAI Codex assisted with the implementation, tests, and benchmarks.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to