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 2022/03/30 08:07:45 UTC

[GitHub] [lucene] BaurzhanSakhariev commented on a change in pull request #770: Implement method to bulk add all collection elements to a PriorityQueue

BaurzhanSakhariev commented on a change in pull request #770:
URL: https://github.com/apache/lucene/pull/770#discussion_r838240191



##########
File path: lucene/core/src/test/org/apache/lucene/util/TestPriorityQueue.java
##########
@@ -163,6 +164,57 @@ public void testInsertWithOverflow() {
     assertEquals((Integer) 2, pq.top());
   }
 
+  public void testAddAllToEmptyQueue() {
+    Random random = random();
+    int size = 10;
+    List<Integer> list = new ArrayList<>();
+    for (int i = 0; i < size; i++) {
+      list.add(random.nextInt());
+    }
+    IntegerQueue pq = new IntegerQueue(size);
+    pq.addAll(list);
+
+    pq.checkValidity();
+    assertOrderedWhenDrained(pq, list);
+  }
+

Review comment:
       > Looks good to me, thank you! Let's wait for checks to pass. Please add CHANGES.txt entry under the corresponding version (main or 9x, if you'd like this backported).
   
   Thanks a lot for reviewing!  
   
   Added a CHANGES entry (without Jira issue as there is no one) to Lucene 9.2.0 under Improvements sections (since there is only one usage and there are more add-in-loop usages - so another PR with changing those could be Optimization).
   
   I wanted to run a benchmark (saw nice tables with baseline comparison in other PR-s but couldn't do the same, 
   found out https://github.com/mikemccand/luceneutil but had some issues with running it. Probably not necessary anyway as I haven't replaced all other potential usages. 
   
   I don't think I can create issues in JIRA, but if there will be any to apply this method where possible I can address it (at least partially as it's probably big change).
   
   Thanks again for the quick feedback!




-- 
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-unsubscribe@lucene.apache.org

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