tpunder 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_r290945820
##########
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:
Fine by me. I've updated the PR to use the inline style except in the 2
cases where the count is used outside of the loop.
----------------------------------------------------------------
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]