title: Internal changes for limit and unordered stream
body: <p>Basically this came up while trying to answer another question. Suppose this code:</p>
  
  <pre><code>AtomicInteger i = new AtomicInteger(0);
  AtomicInteger count = new AtomicInteger(0);
  IntStream.generate(() -&gt; i.incrementAndGet())
          .parallel()
          .peek(x -&gt; count.incrementAndGet())
          .limit(5)
          .forEach(System.out::println);
  
  System.out.println("count = " + count);
  </code></pre>
  
  <p>I understand the fact that <code>IntStream#generate</code> is an <em>unordered infinite stream</em> and for it to finish there has to be a short-circuiting operation (<code>limit</code> in this case). I also understand that the <code>Supplier</code> is free to be called as many number of times the Stream implementation feels like before it reaches that limit.</p>
  
  <p>Running this under java-8, would print <code>count</code> always <code>512</code> (may be not always, but it is so on my machine).</p>
  
  <p>On the contrast running this under java-10 rarely exceeds <code>5</code>. So my question is what changed internally that the short-circuiting happens so much better (I am trying to answer this on my own by having the sources and trying to do some diffs... ) </p>