lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1601750 - in /lucene/dev/trunk/lucene: ./ codecs/src/java/org/apache/lucene/codecs/diskdv/ core/src/java/org/apache/lucene/codecs/lucene49/
Date Tue, 10 Jun 2014 19:20:36 GMT
Author: rmuir
Date: Tue Jun 10 19:20:35 2014
New Revision: 1601750

URL: http://svn.apache.org/r1601750
Log:
LUCENE-5750: speed up monotonic address in BINARY/SORTED_SET

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesProducer.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1601750&r1=1601749&r2=1601750&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Tue Jun 10 19:20:35 2014
@@ -260,6 +260,9 @@ Optimizations
 * LUCENE-5721: Monotonic compression doesn't use zig-zag encoding anymore.
   (Robert Muir, Adrien Grand)
 
+* LUCENE-5750: Speed up monotonic addressing for BINARY and SORTED_SET 
+  docvalues. (Robert Muir)
+
 Bug fixes
 
 * LUCENE-5738: Ensure NativeFSLock prevents opening the file channel for the

Modified: lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java?rev=1601750&r1=1601749&r2=1601750&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
(original)
+++ lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
Tue Jun 10 19:20:35 2014
@@ -34,7 +34,7 @@ class DiskDocValuesProducer extends Luce
   @Override
   protected MonotonicBlockPackedReader getAddressInstance(IndexInput data, FieldInfo field,
BinaryEntry bytes) throws IOException {
     data.seek(bytes.addressesOffset);
-    return MonotonicBlockPackedReader.of(data.clone(), bytes.packedIntsVersion, bytes.blockSize,
bytes.count, true);
+    return MonotonicBlockPackedReader.of(data.clone(), bytes.packedIntsVersion, bytes.blockSize,
bytes.count+1, true);
   }
 
   @Override
@@ -45,6 +45,6 @@ class DiskDocValuesProducer extends Luce
   @Override
   protected MonotonicBlockPackedReader getOrdIndexInstance(IndexInput data, FieldInfo field,
NumericEntry entry) throws IOException {
     data.seek(entry.offset);
-    return MonotonicBlockPackedReader.of(data.clone(), entry.packedIntsVersion, entry.blockSize,
entry.count, true);
+    return MonotonicBlockPackedReader.of(data.clone(), entry.packedIntsVersion, entry.blockSize,
entry.count+1, true);
   }
 }

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java?rev=1601750&r1=1601749&r2=1601750&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java
(original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesConsumer.java
Tue Jun 10 19:20:35 2014
@@ -288,6 +288,7 @@ public class Lucene49DocValuesConsumer e
 
       final MonotonicBlockPackedWriter writer = new MonotonicBlockPackedWriter(data, BLOCK_SIZE);
       long addr = 0;
+      writer.add(addr);
       for (BytesRef v : values) {
         if (v != null) {
           addr += v.length;
@@ -439,6 +440,7 @@ public class Lucene49DocValuesConsumer e
 
     final MonotonicBlockPackedWriter writer = new MonotonicBlockPackedWriter(data, BLOCK_SIZE);
     long addr = 0;
+    writer.add(addr);
     for (Number v : docToOrdCount) {
       addr += v.longValue();
       writer.add(addr);

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesProducer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesProducer.java?rev=1601750&r1=1601749&r2=1601750&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesProducer.java
(original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene49/Lucene49DocValuesProducer.java
Tue Jun 10 19:20:35 2014
@@ -392,7 +392,7 @@ public class Lucene49DocValuesProducer e
       MonotonicBlockPackedReader addrInstance = addressInstances.get(field.number);
       if (addrInstance == null) {
         data.seek(bytes.addressesOffset);
-        addrInstance = MonotonicBlockPackedReader.of(data, bytes.packedIntsVersion, bytes.blockSize,
bytes.count, false);
+        addrInstance = MonotonicBlockPackedReader.of(data, bytes.packedIntsVersion, bytes.blockSize,
bytes.count+1, false);
         addressInstances.put(field.number, addrInstance);
         ramBytesUsed.addAndGet(addrInstance.ramBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
       }
@@ -411,8 +411,8 @@ public class Lucene49DocValuesProducer e
       
       @Override
       public BytesRef get(long id) {
-        long startAddress = bytes.offset + (id == 0 ? 0 : addresses.get(id-1));
-        long endAddress = bytes.offset + addresses.get(id);
+        long startAddress = bytes.offset + addresses.get(id);
+        long endAddress = bytes.offset + addresses.get(id+1);
         int length = (int) (endAddress - startAddress);
         try {
           data.seek(startAddress);
@@ -511,7 +511,7 @@ public class Lucene49DocValuesProducer e
       MonotonicBlockPackedReader ordIndexInstance = ordIndexInstances.get(field.number);
       if (ordIndexInstance == null) {
         data.seek(entry.offset);
-        ordIndexInstance = MonotonicBlockPackedReader.of(data, entry.packedIntsVersion, entry.blockSize,
entry.count, false);
+        ordIndexInstance = MonotonicBlockPackedReader.of(data, entry.packedIntsVersion, entry.blockSize,
entry.count+1, false);
         ordIndexInstances.put(field.number, ordIndexInstance);
         ramBytesUsed.addAndGet(ordIndexInstance.ramBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
       }
@@ -556,8 +556,8 @@ public class Lucene49DocValuesProducer e
 
       @Override
       public void setDocument(int docID) {
-        startOffset = offset = (docID == 0 ? 0 : ordIndex.get(docID-1));
-        endOffset = ordIndex.get(docID);
+        startOffset = offset = ordIndex.get(docID);
+        endOffset = ordIndex.get(docID+1L);
       }
 
       @Override



Mime
View raw message