lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Zapletal <lukas.zaple...@qcm.cz>
Subject Uneffective writeBytes and readBytes
Date Tue, 06 Sep 2005 09:24:07 GMT
Hello guys!

I`am using Lucene in a searching applet. When the applet runs in
unsigned mode, it cannot read files from disk, so I use in-memory
index. I load all index files from a ZIP file to RAMDirectory.

Now I have indexed large data (200MB) and I noticed the loading is too
slow. I have found the place to optimize:

store.OutputStream (in SVN this is store.BufferedIndexOutput):

  public void writeBytes(byte[] b, int length) throws IOException {
    for (int i = 0; i < length; i++)
      writeByte(b[i]);
  }

Because I write (copy resp.) whole index in one sequence, my profiler
showed me, the writeByte(byte b) method is called in million of times.

I have noticed the readBytes in store.InputStream is implemented more
optimaly. Anyway in this situation the buffer reading byte-by-byte is
not so good too. This should be also optimized.

This uneffective implementation is in my opinion slows down index
creation. Much more better could be reading/writing without any
byte-by-byte coping.

Could I try to write a patch for it? Will you accept it? Thanks for
help.

-- 
S pozdravem / Best regards
Lukas Zapletal
sefredaktor / editor-in-chief
LinuxEXPRES - opravdovy linuxovy magazin
www.LinuxEXPRES.cz
tel.:+420 777 003 843


---------------------------------------------------------------------
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