jpountz commented on a change in pull request #698: LUCENE-8834: Cache the
SortedNumericDocValues.docValueCount() value whenever it is used in a loop
URL: https://github.com/apache/lucene-solr/pull/698#discussion_r290928309
##########
File path:
lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene70/Lucene70DocValuesConsumer.java
##########
@@ -158,7 +158,8 @@ void nextBlock() {
long gcd = 0;
Set<Long> uniqueValues = new HashSet<>();
for (int doc = values.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc
= values.nextDoc()) {
- for (int i = 0, count = values.docValueCount(); i < count; ++i) {
+ final int docValueCount = values.docValueCount();
+ for (int i = 0, count = docValueCount; i < count; ++i) {
Review comment:
could you leave it the way it was before, it already cached the
docValueCount? Maybe this way of caching the docValueCount is a bit better by
the way as it gives a smaller scope to the variable?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]