donnerpeter commented on pull request #2457: URL: https://github.com/apache/lucene-solr/pull/2457#issuecomment-791448721
The latter is ~10% faster, so there's some difference. `RunAutomaton.step` has a constant-time array access branch, and it's taken quite often, it seems. On Fri, 5 Mar 2021 at 15:03, Robert Muir <notificati...@github.com> wrote: > *@rmuir* commented on this pull request. > ------------------------------ > > In > lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/TrigramAutomaton.java > <https://github.com/apache/lucene-solr/pull/2457#discussion_r588317811>: > > > + for (int start = 0; start < s1.length(); start++) { > + int limit = Math.min(s1.length(), start + N); > + for (int end = start + 1; end <= limit; end++) { > + substringCounts.merge(s1.substring(start, end), 1, Integer::sum); > + } > + > + int state = initialState; > + for (int i = start; i < limit; i++) { > + int next = builder.createState(); > + builder.addTransition(state, next, s1.charAt(i)); > + state = next; > + } > + } > + > + automaton = > + new CharacterRunAutomaton( > > Both Automaton.step and CharacterRunAutomaton.step are binary search > (transition labels vs character classes, which probably isn't very > different here) > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/apache/lucene-solr/pull/2457#discussion_r588317811>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAA5ZGNURLRJ3Y5KTE5YSHDTCDQEZANCNFSM4YUX3ODA> > . > ---------------------------------------------------------------- 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. 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