in BytesRefHash constructor avoid duplicate BytesStartArray.bytesUsed() call (#13032)

This commit is contained in:
Christine Poerschke 2024-02-08 08:02:40 +00:00 committed by GitHub
parent e5bceb4086
commit bff5ac0ed0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -79,8 +79,8 @@ public final class BytesRefHash implements Accountable {
Arrays.fill(ids, -1);
this.bytesStartArray = bytesStartArray;
bytesStart = bytesStartArray.init();
bytesUsed =
bytesStartArray.bytesUsed() == null ? Counter.newCounter() : bytesStartArray.bytesUsed();
final Counter bytesUsed = bytesStartArray.bytesUsed();
this.bytesUsed = bytesUsed == null ? Counter.newCounter() : bytesUsed;
bytesUsed.addAndGet(hashSize * (long) Integer.BYTES);
}