You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "original-brownbear (via GitHub)" <gi...@apache.org> on 2024/07/24 19:13:27 UTC

[PR] Save allocating some zero length byte arrays [lucene]

original-brownbear opened a new pull request, #13608:
URL: https://github.com/apache/lucene/pull/13608

   Something I found in an ES heap dump. For large numbers of `FieldReader` where the minimum term is an empty string, we allocate MBs worth of empty `byte[]` for larger nodes. Worth adding the conditional here to save some heap I think, allocating empty instances is also somewhat common in other scenarios.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Save allocating some zero length byte arrays [lucene]

Posted by "uschindler (via GitHub)" <gi...@apache.org>.
uschindler commented on PR #13608:
URL: https://github.com/apache/lucene/pull/13608#issuecomment-2248785078

   > Something I found in an ES heap dump. For large numbers of `FieldReader` where the minimum term is an empty string, we allocate MBs worth of empty `byte[]` for larger nodes. Worth adding the conditional here to save some heap I think, allocating empty instances is also somewhat common in other scenarios.
   
   Normally the allocation of empty arrays is elided by the optimizer (under normal circumstances). So something like 'list.toArray(new array[0])` is optimized away and its basically a bad idea to allocate anything larger to fit list size.
   
   The problem here is that those arrays are long-living because they are packed into a BytesRef and the compiler can't figure out at runtime in an easy way that it is useless to allocate it at all.
   
   So I'd merge this and backport it to 9.x. 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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Save allocating some zero length byte arrays [lucene]

Posted by "uschindler (via GitHub)" <gi...@apache.org>.
uschindler merged PR #13608:
URL: https://github.com/apache/lucene/pull/13608


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Save allocating some zero length byte arrays [lucene]

Posted by "uschindler (via GitHub)" <gi...@apache.org>.
uschindler commented on PR #13608:
URL: https://github.com/apache/lucene/pull/13608#issuecomment-2248788504

   Sorry I fogot the changes text!


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Save allocating some zero length byte arrays [lucene]

Posted by "original-brownbear (via GitHub)" <gi...@apache.org>.
original-brownbear commented on PR #13608:
URL: https://github.com/apache/lucene/pull/13608#issuecomment-2248806106

   Thanks Uwe!
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Save allocating some zero length byte arrays [lucene]

Posted by "uschindler (via GitHub)" <gi...@apache.org>.
uschindler commented on PR #13608:
URL: https://github.com/apache/lucene/pull/13608#issuecomment-2248795826

   Backported.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org