You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/05/17 13:26:14 UTC

[GitHub] [lucene] dweiss opened a new pull request #141: LUCENE-9960: Avoid unnecessary top element replacement for equal elements in PQ

dweiss opened a new pull request #141:
URL: https://github.com/apache/lucene/pull/141


   


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



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


[GitHub] [lucene] dweiss commented on a change in pull request #141: LUCENE-9960: Avoid unnecessary top element replacement for equal elements in PQ

Posted by GitBox <gi...@apache.org>.
dweiss commented on a change in pull request #141:
URL: https://github.com/apache/lucene/pull/141#discussion_r633528657



##########
File path: lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java
##########
@@ -138,7 +141,7 @@ public T insertWithOverflow(T element) {
     if (size < maxSize) {
       add(element);
       return null;
-    } else if (size > 0 && !lessThan(element, heap[1])) {

Review comment:
       This is the core of the change that makes pq object selection "stable".




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



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


[GitHub] [lucene] dweiss merged pull request #141: LUCENE-9960: Avoid unnecessary top element replacement for equal elements in PQ

Posted by GitBox <gi...@apache.org>.
dweiss merged pull request #141:
URL: https://github.com/apache/lucene/pull/141


   


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



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


[GitHub] [lucene] dweiss commented on a change in pull request #141: LUCENE-9960: Avoid unnecessary top element replacement for equal elements in PQ

Posted by GitBox <gi...@apache.org>.
dweiss commented on a change in pull request #141:
URL: https://github.com/apache/lucene/pull/141#discussion_r633529024



##########
File path: lucene/core/src/test/org/apache/lucene/util/TestPriorityQueue.java
##########
@@ -47,6 +49,50 @@ protected final void checkValidity() {
     }
   }
 
+  public void testZeroSizedQueue() {

Review comment:
       And this is a demonstration of why zero-sized PQ exhibits invalid behavior.




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



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


[GitHub] [lucene] dweiss commented on a change in pull request #141: LUCENE-9960: Avoid unnecessary top element replacement for equal elements in PQ

Posted by GitBox <gi...@apache.org>.
dweiss commented on a change in pull request #141:
URL: https://github.com/apache/lucene/pull/141#discussion_r633528657



##########
File path: lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java
##########
@@ -138,7 +141,7 @@ public T insertWithOverflow(T element) {
     if (size < maxSize) {
       add(element);
       return null;
-    } else if (size > 0 && !lessThan(element, heap[1])) {

Review comment:
       This is the core of the change that makes pq object selection "stable".

##########
File path: lucene/core/src/test/org/apache/lucene/util/TestPriorityQueue.java
##########
@@ -47,6 +49,50 @@ protected final void checkValidity() {
     }
   }
 
+  public void testZeroSizedQueue() {

Review comment:
       And this is a demonstration of why zero-sized PQ exhibits invalid behavior.




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



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