diff options
author | George Fraser <george@fivetran.com> | 2018-12-29 11:40:38 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-29 11:40:38 -0800 |
commit | f463bee9f5ac5da849c522970f78e0756663516f (patch) | |
tree | 2ec0ee668e3c8e8b945585e63327b2bb16bb38cc /src/test/java | |
parent | f38688c8b05c9df9115b49866c86e273bbb3e160 (diff) | |
download | java-language-server-f463bee9f5ac5da849c522970f78e0756663516f.zip |
Try mapped byte buffers
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/javacs/StringSearchBenchmark.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/test/java/org/javacs/StringSearchBenchmark.java b/src/test/java/org/javacs/StringSearchBenchmark.java index 015dfdd..5d82655 100644 --- a/src/test/java/org/javacs/StringSearchBenchmark.java +++ b/src/test/java/org/javacs/StringSearchBenchmark.java @@ -10,18 +10,31 @@ import org.openjdk.jmh.annotations.*; @Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS) @Fork(1) public class StringSearchBenchmark { - private static final Path largeFile = Paths.get(FindResource.uri("/org/javacs/example/LargeFile.java")); + private static final Path largeFile = Paths.get(FindResource.uri("/org/javacs/example/LargeFile.java")), + smallFile = Paths.get(FindResource.uri("/org/javacs/example/Goto.java")); // "removeMethodBodies" appears late in the file, so stopping early will not be very effective private static final String query = "removeMethodBodies"; @Benchmark - public void regex() { + public void regexSmall() { + var found = Parser.containsWordMatching(smallFile, query); + assert found; + } + + @Benchmark + public void boyerMooreSmall() { + var found = Parser.containsText(smallFile, query); + assert found; + } + + @Benchmark + public void regexLarge() { var found = Parser.containsWordMatching(largeFile, query); assert found; } @Benchmark - public void boyerMoore() { + public void boyerMooreLarge() { var found = Parser.containsText(largeFile, query); assert found; } |