You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "donnerpeter (via GitHub)" <gi...@apache.org> on 2023/05/19 19:07:03 UTC

[GitHub] [lucene] donnerpeter commented on a diff in pull request #12316: hunspell (minor): reduce allocations when processing compound rules

donnerpeter commented on code in PR #12316:
URL: https://github.com/apache/lucene/pull/12316#discussion_r1199286526


##########
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java:
##########
@@ -155,7 +155,7 @@ public class Dictionary {
   boolean checkCompoundCase, checkCompoundDup, checkCompoundRep;
   boolean checkCompoundTriple, simplifiedTriple;
   int compoundMin = 3, compoundMax = Integer.MAX_VALUE;
-  List<CompoundRule> compoundRules; // nullable
+  CompoundRule[] compoundRules; // nullable

Review Comment:
   With the list, the question arose whether to iterate over it with foreach or with indexed access. The latter definitely has no allocations but results in wordier code (including an IDE suppression comment). So I chose an array to get the best of both worlds :)



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