stefanvodita commented on issue #12734:
URL: https://github.com/apache/lucene/issues/12734#issuecomment-1806557718

   I spent some more time with the code and I can attempt answering the 
questions in the description.
   
   1. Yes. We rely on zeros in slice buffers to tell us where a slice ends (the 
first non-zero byte is the last byte of the slice) 
([example](https://github.com/apache/lucene/blob/4e2ce76b3e131ba92b7327a52460e6c4d92c5e33/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java#L2144)).
 There are two cases where we do this. The first is in `TermsHashField` 
([code](https://github.com/apache/lucene/blob/4e2ce76b3e131ba92b7327a52460e6c4d92c5e33/lucene/core/src/java/org/apache/lucene/index/TermsHashPerField.java#L224))
 for a byte pool that is never reset. That means we don't have to zero out the 
buffers of a byte pool. The second is in `MemoryIndex` 
([code](https://github.com/apache/lucene/blob/4e2ce76b3e131ba92b7327a52460e6c4d92c5e33/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java#L257))
 for an int pool that is reset, so we can't skip zeroing out the buffers on 
reset.
   2. Yes, I think it makes more sense for the `Allocator` to handle zeroing 
the buffers, but I don't think there's enough of a benefit to make the change 
on its own.
   
   So, is there anything to be done? We can remove the option of zeroing byte 
buffers and move the responsibility for zeroing int buffers to the `Allocator`. 
Is that worth doing? Maybe, but it's not obvious to me that there is enough of 
a benefit to change how things already work.


-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to