[cp-patches] RFC: InputStreamReader and OutputStreamWriter cleanup

Roman Kennke roman.kennke at aicas.com
Thu Jan 4 17:47:40 UTC 2007

Hi again,

> >>On most free JVMs that I know of (libgcj), array accesses are much 
> >>faster than the corresponding actions on a java.nio.Buffer.
> > 
> > 
> > I don't think so. The normal bytebuffer is also only an array. The
> > accessor methods should not make much difference.
> > 
> The key difference is that, in gcj for example, an array access is 
> translated in to a machine instruction that directly accesses the 
> desired element.  Access through a java.nio.Buffer involves at least one 
> function call which is a much heavier weight operation.

Ok. I can see that. (You should patch GCJ to recognize calls to
ByteBuffer and replace that with array access -- and calls to a direct
ByteBuffer with raw memory access if that's any difference).

However, if you look at the old code you'll see that we did use Buffers
even there. And copy from array into buffer and back. This is cleaned up
by this patch a little and also removed some copies and allocations.
I'll benchmark it this evening and see what comes out of it.


More information about the Classpath-patches mailing list