Last active
August 5, 2020 12:29
-
-
Save doom369/85fe46d6386d93f9b1f0ac3e154935c1 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 EqualsIgnoreCase { | |
@Param({"HELLO WORLD", "Hello World", "hello world", "otherParam"}) | |
String strParams; | |
@Benchmark | |
public boolean equalsAndToLowerCase() { | |
return "hello world".equals(strParams.toLowerCase()); | |
} | |
@Benchmark | |
public boolean equalsIgnoreCase() { | |
return "hello world".equalsIgnoreCase(strParams); | |
} | |
@Benchmark | |
public boolean equals() { | |
return "hello world".equals(strParams); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment