bruno-roustant commented on a change in pull request #1281: LUCENE-9245:
Optimize AutomatonTermsEnum memory and automaton
Operations.getCommonPrefixBytesRef.
URL: https://github.com/apache/lucene-solr/pull/1281#discussion_r383260144
##########
File path: lucene/core/src/java/org/apache/lucene/index/AutomatonTermsEnum.java
##########
@@ -160,17 +161,18 @@ private void setLinear(int position) {
if (maxInterval != 0xff)
maxInterval++;
int length = position + 1; /* position + maxTransition */
- if (linearUpperBound.bytes.length < length)
- linearUpperBound.bytes = new byte[length];
+ if (linearUpperBound == null) {
+ linearUpperBound = new BytesRef(ArrayUtil.oversize(Math.max(length, 16),
Byte.BYTES));
+ } else if (linearUpperBound.bytes.length < length) {
+ linearUpperBound.bytes = new byte[ArrayUtil.oversize(length,
Byte.BYTES)];
Review comment:
+1 thanks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]