lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r553947 - in /lucene/java/trunk/src/java/org/apache/lucene/index: DocumentWriter.java DocumentsWriter.java FieldsReader.java TermVectorsReader.java
Date Fri, 06 Jul 2007 16:34:42 GMT
Author: yonik
Date: Fri Jul  6 09:34:40 2007
New Revision: 553947

URL: http://svn.apache.org/viewvc?view=rev&rev=553947
Log:
replace div with shift since idiv takes ~40 cycles and compiler can't do strength reduction
w/o knowing ops are non-negative

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsReader.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java?view=diff&rev=553947&r1=553946&r2=553947
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentWriter.java Fri Jul  6 09:34:40
2007
@@ -323,7 +323,7 @@
     if (lo >= hi)
       return;
 
-    int mid = (lo + hi) / 2;
+    int mid = (lo + hi) >>> 1;
 
     if (postings[lo].term.compareTo(postings[mid].term) > 0) {
       Posting tmp = postings[lo];

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java?view=diff&rev=553947&r1=553946&r2=553947
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java Fri Jul  6 09:34:40
2007
@@ -734,7 +734,7 @@
       if (lo >= hi)
         return;
 
-      int mid = (lo + hi) / 2;
+      int mid = (lo + hi) >>> 1;
 
       if (comparePostings(postings[lo], postings[mid]) > 0) {
         Posting tmp = postings[lo];
@@ -792,7 +792,7 @@
       if (lo >= hi)
         return;
 
-      int mid = (lo + hi) / 2;
+      int mid = (lo + hi) >>> 1;
 
       if (comparePostings(postings[lo].p, postings[mid].p) > 0) {
         PostingVector tmp = postings[lo];
@@ -880,9 +880,9 @@
             int hashSize = fp.postingsHashSize;
 
             // Reduce hash so it's between 25-50% full
-            while (fp.numPostings < hashSize/2 && hashSize >= 2)
-              hashSize /= 2;
-            hashSize *= 2;
+            while (fp.numPostings < (hashSize>>1) && hashSize >= 2)
+              hashSize >>= 1;
+            hashSize <<= 1;
 
             if (hashSize != fp.postingsHash.length)
               fp.rehashPostings(hashSize);
@@ -1598,7 +1598,7 @@
 
         postingsHash = newHash;
         postingsHashSize = newSize;
-        postingsHashHalfSize = newSize/2;
+        postingsHashHalfSize = newSize >> 1;
       }
       
       final ByteSliceReader vectorSliceReader = new ByteSliceReader();

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java?view=diff&rev=553947&r1=553946&r2=553947
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java Fri Jul  6 09:34:40
2007
@@ -82,7 +82,7 @@
       assert ((int) (indexStream.length()/8)) >= size + this.docStoreOffset;
     } else {
       this.docStoreOffset = 0;
-      this.size = (int) (indexStream.length() / 8);
+      this.size = (int) (indexStream.length() >> 3);
     }
   }
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsReader.java?view=diff&rev=553947&r1=553946&r2=553947
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsReader.java Fri Jul  6 09:34:40
2007
@@ -62,7 +62,7 @@
       tvfFormat = checkValidFormat(tvf);
       if (-1 == docStoreOffset) {
         this.docStoreOffset = 0;
-        this.size = (int) (tvx.length() / 8);
+        this.size = (int) (tvx.length() >> 3);
       } else {
         this.docStoreOffset = docStoreOffset;
         this.size = size;



Mime
View raw message