Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] mechanical sympathy in netty-4

Hi Simone,

On Wednesday, October 16, 2013 at 5:39 PM, Simone Bordet wrote:

On Wed, Oct 16, 2013 at 4:17 PM, Viktor Szathmary <phraktle@xxxxxxxxx> wrote:
InputStreamReader allocates a HeapByteBuffer:

Sure, but this is JDK code, not Jetty code, so we have no control.
Understood. However, it's not entirely hopeless to provide an improved alternative for inefficient JDK implementations (as you already have done in many instances :)

For example, a patch in the same vein I have provided for reusing deflaters in gzip outputstreams: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402885,

similarly, PrintWriter construction is a synchronized bottleneck, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414353 

In this particular use case (Request#getReader), it's not clear to me if there is a benefit from using an 8k buffered reader – perhaps a plain reader would work out better w/o allocation?

In our Jetty-based application we ended up removing Reader / Writer usage, as they have a very high overhead compared to directly using the streams (buffer allocations, synchronization). 

(All of the above is besides the original point of this thread, as Jetty does reuse buffers in general very well!)

Regards,
  Viktor

Back to the top