This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fdadbb888d HDDS-16310. Avoid allocating a comparator per HeapEntry 
comparison in ListIterator (#11137)
9fdadbb888d is described below

commit 9fdadbb888d495341776174b841f1481c0b8780a
Author: KUAN-HAO HUANG <[email protected]>
AuthorDate: Fri Aug 28 20:20:58 2026 +0800

    HDDS-16310. Avoid allocating a comparator per HeapEntry comparison in 
ListIterator (#11137)
---
 .../src/main/java/org/apache/hadoop/ozone/om/ListIterator.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ListIterator.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ListIterator.java
index e7737c20699..a0b3ded891e 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ListIterator.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ListIterator.java
@@ -56,6 +56,10 @@ public interface ClosableIterator extends 
Iterator<HeapEntry>, Closeable {
    * Entry to be added to the heap.
    */
   public static class HeapEntry implements Comparable<HeapEntry> {
+    private static final Comparator<HeapEntry> COMPARATOR =
+        Comparator.comparing(HeapEntry::getKey)
+            .thenComparingInt(HeapEntry::getEntryIteratorId);
+
     private final int entryIteratorId;
     private final String tableName;
     private final String key;
@@ -87,8 +91,7 @@ public Object getValue() {
 
     @Override
     public int compareTo(HeapEntry other) {
-      return Comparator.comparing(HeapEntry::getKey)
-          .thenComparing(HeapEntry::getEntryIteratorId).compare(this, other);
+      return COMPARATOR.compare(this, other);
     }
 
     @Override


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

Reply via email to