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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]