lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Delaying buffer allocation in BufferedIndexInput
Date Mon, 12 Sep 2005 17:45:14 GMT
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message