Hi, This patch implements optimizations for the limit/substream operations when input to those operations have certain properties (corresponding to known size or unordered) which helps to avoid out of memory issues (not all, we still have some more work to do).
The {Xxx}/Stream.generate methods have been modified to generate a known infinite stream of unordered elements. Previously an ordered known infinite stream of elements was generated, making it particularly prone to OOMEs. http://cr.openjdk.java.net/~psandoz/tl/JDK-8012987-slice/webrev/ - This is based on the following in order, still requiring reviews (hint hint): http://cr.openjdk.java.net/~psandoz/tl/JDK-8016308-Node/webrev/ http://cr.openjdk.java.net/~psandoz/tl/JDK-8016324-pipelines/webrev/ http://cr.openjdk.java.net/~psandoz/tl/JDK-8016455-stream-tests/webrev/ Plus: http://cr.openjdk.java.net/~henryjen/ccc/8009736.2/webrev/ (Note this is not rebased in this version, but is in my patch queue) Paul.