donnerpeter commented on a change in pull request #2414:
URL: https://github.com/apache/lucene-solr/pull/2414#discussion_r580215786



##########
File path: 
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Hunspell.java
##########
@@ -540,7 +566,36 @@ boolean acceptsStem(int formID) {
     if (word.contains("-") && suggestions.stream().noneMatch(s -> 
s.contains("-"))) {
       suggestions.addAll(modifyChunksBetweenDashes(word));
     }
+  }
+
+  private Runnable checkTimeLimit(String word, WordCase wordCase, Set<String> 
suggestions) {
+    return new Runnable() {
+      final long limit = System.nanoTime() + 
TimeUnit.MILLISECONDS.toNanos(SUGGEST_TIME_LIMIT);
+      int invocationCounter = 100;
+
+      @Override
+      public void run() {
+        checkCanceled.run();
+        if (--invocationCounter <= 0) {
+          if (System.nanoTime() > limit) {

Review comment:
       We get system time only on each 100th call, like Hunspell does, since 
that isn't exactly free




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



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

Reply via email to