dweiss commented on code in PR #13936:
URL: https://github.com/apache/lucene/pull/13936#discussion_r1807867567


##########
lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java:
##########
@@ -270,7 +280,7 @@ public final boolean remove(T element) {
     return false;
   }
 
-  private final boolean upHeap(int origPos) {
+  private boolean upHeap(int origPos, T[] heap) {

Review Comment:
   I'd create a local heap variable (var heap = this.heap) locally in this 
method, not pass it as an argument. It is confusing why you'd want it as an 
argument. I agree with Robert here that we should perhaps see long-term 
maintenance as worth the tiny performance benefit (although I think assigning 
to a local variable within the method would yield the same result).
   



##########
lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java:
##########
@@ -117,26 +117,29 @@ public PriorityQueue(int maxSize, Supplier<T> 
sentinelObjectSupplier) {
    * ArrayIndexOutOfBoundsException} is thrown.
    */
   public void addAll(Collection<T> elements) {
-    if (this.size + elements.size() > this.maxSize) {
+    int s = size;

Review Comment:
   Can we at least rename "s" to "size" and use this.size as the right hand 
side of this assignment?



-- 
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