You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Lukas Zapletal <lu...@qcm.cz> on 2005/09/20 11:03:48 UTC
[PATCH] BufferedIndexOutput - optimized writeBytes() method
[PATCH] BufferedIndexOutput - optimized writeBytes() method
-----------------------------------------------------------
Key: LUCENE-435
URL: http://issues.apache.org/jira/browse/LUCENE-435
Project: Lucene - Java
Type: Improvement
Components: Store
Reporter: Lukas Zapletal
Priority: Minor
I have created a patch that optimize writeBytes metod:
public void writeBytes(byte[] b, int length) throws IOException {
if (bufferPosition > 0) // flush buffer
flush();
if (length < BUFFER_SIZE) {
flushBuffer(b, length);
bufferStart += length;
} else {
int pos = 0;
int size;
while (pos < length) {
if (length - pos < BUFFER_SIZE) {
size = length - pos;
} else {
size = BUFFER_SIZE;
}
System.arraycopy(b, pos, buffer, 0, size);
pos += size;
flushBuffer(buffer, size);
bufferStart += size;
}
}
}
Its a much more faster now. I know that for indexing this not help
much, but for copying files in the IndexStore this is so big
improvement. Its about 400% faster that old implementation.
The patch was tested with 300MB data, "ant test" sucessfuly finished
with no errors.
The patch is included in unified format. See the URL.
--
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
Re: [PATCH] BufferedIndexOutput - optimized writeBytes() method
Posted by Lukas Zapletal <lu...@qcm.cz>.
Opps, sorry, I thought JIRA is not sending this...
...just ignore this mail. Thanks
--
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