Paul Elschot wrote:
I tried delaying the buffer allocation in BufferedIndexInput by
using this clone() method:

  public Object clone() {
    BufferedIndexInput clone = (BufferedIndexInput)super.clone();
    clone.buffer = null;
    clone.bufferLength = 0;
    clone.bufferPosition = 0;
clone.bufferStart = getFilePointer(); return clone;
  }

As far as I can see, this delaying should work, but it doesn't and
I have no idea why.

At a glance it looks good to me, so I am also baffled.

I noticed that RAMIndexInput extends BufferedIndexInput.
It has all data in buffers already, so why is there another
layer of buffering?

No good reason: it's historical.

To avoid this either: (a) the BufferedIndexInput API would need to be modified to permit subclasses to supply the buffer; or (b) RAMInputStream could subclass IndexInput directly, using its own buffers. The latter would probably be simpler.

It would be interesting to see if this made things much faster...

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to