You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2025/01/10 06:47:28 UTC
(lucene) branch branch_10x updated: Removing unnecessary ByteArrayDataInput allocations by resetting inplace (#14113)
This is an automated email from the ASF dual-hosted git repository.
ivera pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new b43432cba30 Removing unnecessary ByteArrayDataInput allocations by resetting inplace (#14113)
b43432cba30 is described below
commit b43432cba307355f9b45ad43eb997551f1764f09
Author: Ankit Jain <ak...@amazon.com>
AuthorDate: Fri Jan 10 12:14:59 2025 +0530
Removing unnecessary ByteArrayDataInput allocations by resetting inplace (#14113)
Removing unnecessary ByteArrayDataInput allocations by resetting inplace
Signed-off-by: Ankit Jain <ak...@amazon.com>
---
lucene/CHANGES.txt | 2 ++
.../apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java | 9 ++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 15679c0d940..e12324b501e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -20,6 +20,8 @@ Improvements
* GITHUB#14079: Hunspell Dictionary now supports an option to tolerate REP rule count mismatches.
(Robert Muir)
+* GITHUB#14113: Remove unnecessary ByteArrayDataInput allocations from `Lucene90DocValuesProducer$TermsDict.decompressBlock`. (Ankit Jain)
+
Optimizations
---------------------
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
index 11e83b3f03c..80dffb7b970 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
@@ -1122,10 +1122,9 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
final LongValues indexAddresses;
final RandomAccessInput indexBytes;
final BytesRef term;
+ final BytesRef blockBuffer;
+ final ByteArrayDataInput blockInput;
long ord = -1;
-
- BytesRef blockBuffer = null;
- ByteArrayDataInput blockInput = null;
long currentCompressedBlockStart = -1;
long currentCompressedBlockEnd = -1;
@@ -1149,6 +1148,7 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
// add 7 padding bytes can help decompression run faster.
int bufferSize = entry.maxBlockLength + entry.maxTermLength + LZ4_DECOMPRESSOR_PADDING;
blockBuffer = new BytesRef(new byte[bufferSize], 0, bufferSize);
+ blockInput = new ByteArrayDataInput();
}
@Override
@@ -1324,8 +1324,7 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
}
// Reset the buffer.
- blockInput =
- new ByteArrayDataInput(blockBuffer.bytes, blockBuffer.offset, blockBuffer.length);
+ blockInput.reset(blockBuffer.bytes, blockBuffer.offset, blockBuffer.length);
}
}