Last active
September 1, 2020 07:15
-
-
Save doom369/c9b9ecc2c7a0dff38c1631af32b44665 to your computer and use it in GitHub Desktop.
This file contains 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 characters
@BenchmarkMode(Mode.AverageTime) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Measurement(iterations = 10, time = 1) | |
public class ReplaceCustom { | |
@Param({"", "somePathNoDoT", "some.Path.With.Dot"}) | |
String value; | |
@Benchmark | |
public String replace() { | |
return value.replace(".", "/"); | |
} | |
@Benchmark | |
public String replaceSpring() { | |
return springReplace(value, ".", "/"); | |
} | |
@Benchmark | |
public String replaceApache() { | |
return StringUtils.replace(value, ".", "/"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment