You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/06/05 20:49:41 UTC

[GitHub] [lucene-solr] jpountz commented on a change in pull request #698: LUCENE-8834: Cache the SortedNumericDocValues.docValueCount() value whenever it is used in a loop

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org