[External] : Re: jstack, profilers and other tools
Alan Bateman
Alan.Bateman at oracle.com
Mon Aug 1 05:59:43 UTC 2022
On 24/07/2022 14:05, Alex Otenko wrote:
> :
>
> Also, I am not clear why you dismissed the allocation problem by just
> saying IO buffering is the same. The allocation problem is that user
> code allocates before read(byte[]) is called. This is the same in both
> sync and async code. The difference is that in async code the lifespan
> of the allocation is shorter - we read only read-ready channels, and
> those that aren't ready return quickly. In sync code the buffer
> remains allocated for a long time - even seconds, if that's what the
> connection reuse pattern is on the client side.
>
I think I've replied to you a few times on topic, but just to say again
that we haven't dismissed adding overloads of read that would take a
supplier or provide other means to lazily get the buffer when there are
bytes available. This project's position on this has always been that we
would see how far we would get first. The reason for caution is that
there are many issues with such APIs (as it's essentially callback at a
very low level) and in addition it would support through many layers and
libraries to get any real benefit.
-Alan
More information about the loom-dev
mailing list