<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">It&#39;s not a bug.  Measuring the length of the source before allocating<br>the destination array is usually a big win when compared to repeatedly<br>growing the array&#39;s memory and copying all its elements.<br>-- <br>-Dave</blockquote><div><br></div><div>Usually yes, but not in the case of lazy filter. If predicate contains anything more than a dozen CPU instructions, single-pass version is faster.</div><div><br></div><div>We often want the predicate to have side effects, but we cannot with current implementation: the side effects will be doubled.</div><div><br></div><div>I also wonder if it&#39;s possible to allocate array with capacity of underlying collection (before all lazy stuff) and shrink it in the end.</div><div><br></div><div>- Anton</div></div>