code: public static void profileRulesOnText(String contents,
                                          JLanguageTool lt) throws IOException {
      long[] workTime = new long[10];
      List<Rule> rules = lt.getAllActiveRules();
      int ruleCount = rules.size();
      System.out.printf("Testing %d rules%n", ruleCount);
      System.out.println("Rule ID\tTime\tSentences\tMatches\tSentences per sec.");
      List<String> sentences = lt.sentenceTokenize(contents);
      for (Rule rule : rules) {
        if (rule instanceof TextLevelRule) {
          continue; // profile rules for sentences only
        }
        int matchCount = 0;
        for (int k = 0; k < 10; k++) {
          long startTime = System.currentTimeMillis();
          for (String sentence : sentences) {
            matchCount += rule.match
                    (lt.getAnalyzedSentence(sentence)).length;
          }
          long endTime = System.currentTimeMillis();
          workTime[k] = endTime - startTime;
        }
        long time = median(workTime);
        float timeInSeconds = time / 1000.0f;
        float sentencesPerSecond = sentences.size() / timeInSeconds;
        System.out.printf(Locale.ENGLISH,
                "%s\t%d\t%d\t%d\t%.1f", rule.getId(),
                time, sentences.size(), matchCount, sentencesPerSecond);
        System.out.println();
      }
    }
docs: Simple rule profiler - used to run LT on a corpus to see which
  rule takes most time. Prints results to System.out.
  
  @param contents text to check
  @param lt instance of LanguageTool