costin commented on PR #16381:
URL: https://github.com/apache/lucene/pull/16381#issuecomment-4943722970

   Thanks for the detailed reply. I see what you mean. 
   Agreed the get() hit penalty makes this a poor fit for CharArrayMap versus 
CharArraySet and its contains().
   
   Building on the idea of freeze(), how about a factory method instead? Same 
outcome (immutable, cached) but without adding lifecycle to a mutable class. 
Something like:
   ```
   CharArraySet.fastInsensitive(collection)
   CharArraySet.fastInsensitive(collection, maxWordLength)
   ```
   
   Method returns an immutable instance with the packed lookup applied. 
   No changes to CharArrayMap, explicit opt-in by choosing the factory. Memory 
overhead is just the LongHashSet alongside the existing table, roughly 500 
bytes for a typical stop word list.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to