From 4406d75b002851b6e6b8241e7bc75856dac66236 Mon Sep 17 00:00:00 2001 From: expani Date: Fri, 18 Oct 2024 15:40:05 +0530 Subject: [PATCH] Benchmarking effects of only using writeLong instead of writeInt --- .../benchmark/jmh/DocIdEncodingBenchmark.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/DocIdEncodingBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/DocIdEncodingBenchmark.java index 05d851c1d75..aacd654ae88 100644 --- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/DocIdEncodingBenchmark.java +++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/DocIdEncodingBenchmark.java @@ -309,7 +309,8 @@ public class DocIdEncodingBenchmark { out.writeLong(packedLong); } for (; i < count; i++) { - out.writeInt(docIds[i]); + //out.writeInt(docIds[i]); + out.writeLong(docIds[i]); } } @@ -323,7 +324,8 @@ public class DocIdEncodingBenchmark { docIDs[i + 2] = (int) (packedLong & BPV_21_MASK); } for (; i < count; i++) { - docIDs[i] = in.readInt(); + //docIDs[i] = in.readInt(); + docIDs[i] = (int) in.readLong(); } } } @@ -363,7 +365,8 @@ public class DocIdEncodingBenchmark { out.writeLong(packedLong); } for (; i < count; i++) { - out.writeInt(docIds[i]); + //out.writeInt(docIds[i]); + out.writeLong(docIds[i]); } } @@ -391,7 +394,8 @@ public class DocIdEncodingBenchmark { docIDs[i + 2] = (int) (packedLong & BPV_21_MASK); } for (; i < count; i++) { - docIDs[i] = in.readInt(); + //docIDs[i] = in.readInt(); + docIDs[i] = (int) in.readLong(); } } } @@ -539,5 +543,6 @@ public class DocIdEncodingBenchmark { } catch (IOException e) { throw new RuntimeException(e); } + } }