Closed GoogleCodeExporter closed 8 years ago
looking for the cause of this, I looked at the source, and took a stab at it.
The attached patch should fix it. However, I pretty much completely rewrote it,
which I found sort of intimidating (I hear Tony the Pony bites). I also don't
really understand why you would want to return the buckets in a steaming
fashion, as they will be only returned when filled anyway, so streaming will
not reduce latency. At the risk of missing something, I still conformed to the
current implementation. It is easily converted to a non-streaming version,
which I have a feeling would be better.
Original comment by MartijnH...@gmail.com
on 1 May 2013 at 9:33
Attachments:
> The attached patch should fix it.
It should first be proven through a failing unit test that there indeed is a
bug to be fixed. I never managed to reproduce the reported issue.
The buckets are streamed so that results are yielded as soon as they are
available and only as many buckets are computed (their items buffered) as
necessary.
Original comment by azizatif
on 2 May 2013 at 7:36
I have seen this happen in the wild (though not with this replacement), but
havent been able to make a reproducible case, so far I have put it down as a
jit bug. Re the streaming, I fully agree that the buckets should be streamed,
just not their content. Is there an example of a case where the streaming
behavior of the contents of buckets has any advantage?
Original comment by MartijnH...@gmail.com
on 2 May 2013 at 8:17
>>
Is there an example of a case where the streaming behavior of the contents of
buckets has any advantage?
<<
I'm guessing you're referring to the following line?
yield return resultSelector(bucket.Select(x => x));
The idea here is not so much streaming but to avoid giving a direct reference
to the underlying array that is mutable. Arguably, one could render the array
read-only with Array.AsReadOnly and it would have performance benefits for the
downstream user but then the last bucket would have to be copied out if it
turned out to be uneven. However that's an implementation detail that can be
changed because it wouldn't break the contract. In the initial and current
implementation, correctness was the first goal.
Original comment by azizatif
on 2 May 2013 at 5:08
well, that does have some merit. If this is indeed a JIT bug of some .NET
version, there is probably no way there will ever be a chance to get a reliable
test case. In that case the current implementation is at least correct, and
this issue should be closed as irreproducible
Original comment by MartijnH...@gmail.com
on 2 May 2013 at 7:18
I would be comfortable with this being resolved as non-reproducible.
Original comment by alastair...@gmail.com
on 2 May 2013 at 10:44
@alastair.pitts, @MartijnHoekstra: thanks for the feedback
Issue closed as wont-fix. It can always be re-opened at a time when it can be
demonstrated through a repeatable and failing test on any of the supported
target platforms. Also considering it's been over 2 years without an
*overwhelming* starring/voting of the issue.
Original comment by azizatif
on 3 May 2013 at 6:30
Original issue reported on code.google.com by
alastair...@gmail.com
on 21 Dec 2010 at 10:51