mirror of https://github.com/apache/lucene.git
Avoid unnecessary memory allocation in PackedLongValues#Iterator (#13439)
We always allocate a long array of page size for a new PackedLongValues#Iterator instance, which is not necessary when packing a small number of values. this is more evident in the scenario of high-frequency flush operations
This commit is contained in:
parent
c132e95369
commit
801b822972
|
@ -249,7 +249,8 @@ Improvements
|
|||
|
||||
Optimizations
|
||||
---------------------
|
||||
(No changes)
|
||||
|
||||
* GITHUB#13439: Avoid unnecessary memory allocation in PackedLongValues#Iterator. (Zhang Chao)
|
||||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
|
|
|
@ -138,7 +138,7 @@ public class PackedLongValues extends LongValues implements Accountable {
|
|||
int currentCount; // number of entries of the current page
|
||||
|
||||
Iterator() {
|
||||
currentValues = new long[pageMask + 1];
|
||||
currentValues = new long[(int) Math.min(size, pageMask + 1)];
|
||||
vOff = pOff = 0;
|
||||
fillBlock();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue