You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2009/09/09 13:51:42 UTC
svn commit: r812904 - in /lucene/java/trunk: CHANGES.txt
src/java/org/apache/lucene/util/OpenBitSet.java
Author: mikemccand
Date: Wed Sep 9 11:51:41 2009
New Revision: 812904
URL: http://svn.apache.org/viewvc?rev=812904&view=rev
Log:
LUCENE-1899: fix slow realloc performance if you set bits in order in a new OpenBitSet
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/src/java/org/apache/lucene/util/OpenBitSet.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=812904&r1=812903&r2=812904&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed Sep 9 11:51:41 2009
@@ -549,6 +549,10 @@
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
Modified: lucene/java/trunk/src/java/org/apache/lucene/util/OpenBitSet.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/OpenBitSet.java?rev=812904&r1=812903&r2=812904&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/OpenBitSet.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/OpenBitSet.java Wed Sep 9 11:51:41 2009
@@ -483,7 +483,6 @@
*/
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 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);
}
}