lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Zapletal <>
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++)

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

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message