lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Adding IndexOutput.writeByte(byte b, int length)
Date Mon, 22 Jun 2009 13:04:00 GMT
I'm testing the performance of some indexing code and noticed that
NormsWriter.flush() calls IndexOutput.writeByte(defaultNorm) in a loop,
writing the same norm every time (lines: 139-140, 157-158, 162-163).

In the run I've spotted it, it occurs few thousands of times (I mean few
thousands of writeByte calls).

I was thinking that if we had writeByte(byte b, int lenght) in IndexOutput,
we can call it once and handle it effeciently where possible. For
back-compat, the default impl would just be looping and calling
writeByte(b), but for others, like BufferedIndexOutout, this could be
filling the array with b, length times. We won't use System.arraycopy which
is faster, but won't call thousands of times to writeByte either.

What do you think?

Shai

Mime
View raw message