mikemccand commented on code in PR #12915:
URL: https://github.com/apache/lucene/pull/12915#discussion_r1426601556


##########
lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseHiraganaUppercaseFilter.java:
##########
@@ -60,15 +60,13 @@ public JapaneseHiraganaUppercaseFilter(TokenStream input) {
   @Override
   public boolean incrementToken() throws IOException {
     if (input.incrementToken()) {
-      String term = termAttr.toString();
-      char[] src = term.toCharArray();
-      char[] result = new char[src.length];
-      for (int i = 0; i < src.length; i++) {
-        Character c = s2l.get(src[i]);
+      char[] result = new char[termAttr.length()];

Review Comment:
   I think this could instead be something like:
   
   ```
       char[] termBuffer = termAttr.buffer();
       int termLength = termAttr.length();
       for(int i=0; i<termLength; i++) {
           Character c = LETTER_MAPPINGS.get(termBuffer[i]);
           if (c != null) {
             termBuffer[i] = c;
           }
       }
   
       return true;
   ```
   
   I.e. you can just directly manipulate the underlying buffer.
   
   But really this is all just optimizing -- not urgent for the first commit of 
this awesome contribution.  It can be done in follow-on PRs.



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