tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <>
Subject Re: bit op dillema
Date Fri, 02 Jun 2000 23:50:22 GMT
Ed Korthof wrote:

> On Fri, 2 Jun 2000 wrote:
> > One thing that will help - and should be done - is to
> > use the ByteBuffer.
> I'll check this out ... umm ... do you mean ByteArrayInputStream?  Or just
> putting a lot of data into a big byte[]?

No, it's a byte[] - the adapter will create ( and reuse ) one instance of
ByteBuffer ( i.e. a byte[], int start, int end ).
The only "special" thing in ByteBuffer is that it generates an event when
the buffer is full ( or empty ) - that allows the adapter to flush the buffer

and generate all the calls to interceptors.

The big difference is that the buffer is more exposed, instead of
using the stream abstraction - that allows to avoid a lot of copy,
and gives much more control over memory and buffers.

Next step will be a CharBuffer - that will be converted to byte[] by
a custom converter ( since this is expensive and can be optimized ).

> Sometimes the effect is much more than this.  A while ago, some changes we
> did to the JServ protocol (which removed the use of StringTokenizers)
> improved efficiency of a relevant operation by more than 60%.  The effect
> was quite striking.

I know, take a look at MimeHeaders too - the Strings are allocated only
if somebody asks for.

The overal effect is striking ideed - for tomcat is alos >50%, but I guess
each change has a small 5..10% effect.

> Anyway, this is the sort of stuff which I find interesting, so I'll look
> at the current code ... I'm assuming it makes more sense to tune Tomcat
> than Catalina, right now?

What is Catalina ?


View raw message