Internal and External truncation conditions

Doug Lea dl at
Sun Feb 10 06:02:21 PST 2013

On 02/10/13 08:47, Remi Forax wrote:
> On 02/10/2013 02:42 PM, Doug Lea wrote:

>> Any per-element lambda supplied to any Stream method can
>> itself do any kind of async cancel check itself, and throw
>> an exception rather than returning a result.
>> Case closed?
> No, throwing an exception when the VM thinks that can it can escape is really slow.

That's my point exactly! If you want to slow down bulk ops
for the sake of responsiveness, then you should be aware of
the tradeoffs. In practice, fine-grained cancel-checks
are rarely worthwhile (you'd often finish 10 times faster,
and thus usually not need to cancel, without the checks).
But it should be the user's decision, not ours.
Otherwise, we cannot internally arrange/support
cancellation any faster than users can, but would
penalize ALL users for the sake of those who need it.


More information about the lambda-libs-spec-observers mailing list