jpountz commented on PR #954:
URL: https://github.com/apache/lucene/pull/954#issuecomment-1153675730

   @gsmiller I wonder if you could also test if there is a speed up if we 
remove checks that the codec has to do in order to make sure to return 
`NO_MORE_ORDS` when values for a doc are exhausted. E.g. 
`Lucene90DocValuesProducer#getSortedSet` looks like this today
   
   ```java
     @Override
     public SortedSetDocValues getSortedSet(FieldInfo field) throws IOException 
{
       SortedSetEntry entry = sortedSets.get(field.name);
       if (entry.singleValueEntry != null) {
         return DocValues.singleton(getSorted(entry.singleValueEntry));
       }
   
       final SortedNumericDocValues ords = getSortedNumeric(entry.ordsEntry);
       return new BaseSortedSetDocValues(entry, data) {
   
         int i = 0;
         int count = 0;
         boolean set = false;
   
         @Override
         public long nextOrd() throws IOException {
           if (set == false) {
             set = true;
             i = 0;
             count = ords.docValueCount();
           }
           if (i++ == count) {
             return NO_MORE_ORDS;
           }
           return ords.nextValue();
         }
   
         @Override
         public long docValueCount() {
           return ords.docValueCount();
         }
   
         @Override
         public boolean advanceExact(int target) throws IOException {
           set = false;
           return ords.advanceExact(target);
         }
   
         @Override
         public int docID() {
           return ords.docID();
         }
   
         @Override
         public int nextDoc() throws IOException {
           set = false;
           return ords.nextDoc();
         }
   
         @Override
         public int advance(int target) throws IOException {
           set = false;
           return ords.advance(target);
         }
   
         @Override
         public long cost() {
           return ords.cost();
         }
       };
     }
   ```
   
   but if we moved everything to this new iteration model, we wouldn't have to 
check if the caller is visiting more values than expected, it would just lead 
to an undefined behavior and we could remove `i`, `count`, `set` and 
`nextOrd()` could delegate directly to `ords.nextValue()`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to