jpountz commented on a change in pull request #322:
URL: https://github.com/apache/lucene/pull/322#discussion_r717760225



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/PForUtil.java
##########
@@ -59,24 +60,30 @@ static boolean allEqual(long[] l) {
   /** Encode 128 integers from {@code longs} into {@code out}. */
   void encode(long[] longs, DataOutput out) throws IOException {
     // Determine the top MAX_EXCEPTIONS + 1 values
-    final long[] top = new long[MAX_EXCEPTIONS + 1];
-    Arrays.fill(top, -1L);
-    for (int i = 0; i < ForUtil.BLOCK_SIZE; ++i) {
-      if (longs[i] > top[0]) {
-        top[0] = longs[i];
-        Arrays.sort(
-            top); // For only a small number of entries we just sort on every 
iteration instead of
-        // maintaining a PQ
+    final LongHeap top = LongHeap.create(LongHeap.Order.MIN, MAX_EXCEPTIONS + 
1);

Review comment:
       Haha, who doesn't need a heap?!




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to