Created
August 29, 2020 21:36
-
-
Save doom369/5563e5ca5532c9714e90ae3e89c3630c to your computer and use it in GitHub Desktop.
Revisions
-
doom369 created this gist
Aug 29, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ @BenchmarkMode(Mode.AverageTime) @Fork(1) @State(Scope.Thread) @Warmup(iterations = 5, time = 1) @OutputTimeUnit(TimeUnit.NANOSECONDS) @Measurement(iterations = 10, time = 1) public class ReplaceAllPrecompiled { @Param({"", "somePathNoDoT", "some.Path.With.Dot"}) String value; private static final Pattern DOT_PATTERN = Pattern.compile("\\."); @Benchmark public String replaceAllWithPrecompiled() { return DOT_PATTERN.matcher(value).replaceAll("%2E"); } }