mirror of https://github.com/apache/lucene.git
LUCENE-1899: fix slow realloc performance if you set bits in order in a new OpenBitSet
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@812904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f5a2d1239
commit
c5c363e540
|
@ -549,6 +549,10 @@ Bug fixes
|
|||
Because of this IndexReader.isLocked() and IndexWriter.isLocked() did
|
||||
not work correctly. (Uwe Schindler)
|
||||
|
||||
* LUCENE-1899: Fix O(N^2) CPU cost when setting docIDs in order in an
|
||||
OpenBitSet, due to an inefficiency in how the underlying storage is
|
||||
reallocated. (Nadav Har'El via Mike McCandless)
|
||||
|
||||
New features
|
||||
|
||||
* LUCENE-1411: Added expert API to open an IndexWriter on a prior
|
||||
|
|
|
@ -483,7 +483,6 @@ public class OpenBitSet extends DocIdSet implements Cloneable, Serializable {
|
|||
*/
|
||||
public void flip(long startIndex, long endIndex) {
|
||||
if (endIndex <= startIndex) return;
|
||||
int oldlen = wlen;
|
||||
int startWord = (int)(startIndex>>6);
|
||||
|
||||
// since endIndex is one past the end, this is index of the last
|
||||
|
@ -742,9 +741,7 @@ public class OpenBitSet extends DocIdSet implements Cloneable, Serializable {
|
|||
*/
|
||||
public void ensureCapacityWords(int numWords) {
|
||||
if (bits.length < numWords) {
|
||||
long[] newBits = new long[numWords];
|
||||
System.arraycopy(bits,0,newBits,0,wlen);
|
||||
bits = newBits;
|
||||
bits = ArrayUtil.grow(bits, numWords);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue