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 characters
@BenchmarkMode(Mode.AverageTime) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Measurement(iterations = 10, time = 1) | |
public class StartsWith { | |
@Param({"http://facebook.com/loginMe", "Http://facebook.com/loginMe", "not url at all"}) | |
String url; |
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 characters
JDK 11.0.8, OpenJDK 64-Bit Server VM, 11.0.8+10 | |
Benchmark | |
EqualsIgnoreCase.equalsAndToLowerCase HELLO WORLD avgt 10 37.890 ± 0.547 ns/op | |
EqualsIgnoreCase.equalsIgnoreCase HELLO WORLD avgt 10 42.518 ± 0.451 ns/op | |
EqualsIgnoreCase.equalsAndToLowerCase Hello World avgt 10 33.204 ± 0.525 ns/op | |
EqualsIgnoreCase.equalsIgnoreCase Hello World avgt 10 27.891 ± 0.288 ns/op | |
EqualsIgnoreCase.equalsAndToLowerCase hello world avgt 10 18.047 ± 0.233 ns/op |
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 characters
Benchmark Mode Cnt Score Error Units | |
Hashcode.apacheCommons avgt 10 3.427 ± 0.025 ns/op | |
Hashcode.defaultHashCode avgt 10 3.440 ± 0.028 ns/op | |
Hashcode.guava avgt 10 8.631 ± 0.098 ns/op | |
Hashcode.lombok avgt 10 3.502 ± 0.060 ns/op | |
Hashcode.objectsHashcode avgt 10 8.722 ± 0.127 ns/op |
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 characters
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@Measurement(iterations = 10, time = 1) | |
public class Hashcode { | |
UserObjects userObjects; | |
UserIDEDefault userIDEDefault; |
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 characters
class User { | |
String email; | |
int age; | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) { | |
return true; |
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 characters
JDK 1.8.0_265, OpenJDK 64-Bit Server VM, 25.265-b01 | |
Benchmark (strParams) Mode Cnt Score Error Units | |
EqualsIgnoreCase.equalsAndToLowerCase HELLO WORLD avgt 10 67.110 ± 0.891 ns/op | |
EqualsIgnoreCase.equalsIgnoreCase HELLO WORLD avgt 10 46.485 ± 0.671 ns/op | |
EqualsIgnoreCase.equalsAndToLowerCase Hello World avgt 10 57.092 ± 1.146 ns/op | |
EqualsIgnoreCase.equalsIgnoreCase Hello World avgt 10 29.846 ± 0.292 ns/op | |
EqualsIgnoreCase.equalsAndToLowerCase hello world avgt 10 23.289 ± 0.188 ns/op |
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 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; |
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 characters
public boolean equals(Object anObject) { | |
if (this == anObject) { | |
return true; | |
} | |
if (anObject instanceof String) { | |
String aString = (String)anObject; | |
if (coder() == aString.coder()) { | |
return isLatin1() ? StringLatin1.equals(value, aString.value) | |
: StringUTF16.equals(value, aString.value); | |
} |
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 characters
Benchmark (url) Mode Cnt Score Error Units | |
EqualChar.equalsOptimized / avgt 10 3.806 ± 0.075 ns/op | |
EqualChar.equalsPost / avgt 10 5.706 ± 0.089 ns/op | |
EqualChar.equalsPre / avgt 10 5.960 ± 0.062 ns/op | |
EqualChar.equalsOptimized /my/server/url avgt 10 3.250 ± 0.204 ns/op | |
EqualChar.equalsPost /my/server/url avgt 10 3.464 ± 0.116 ns/op | |
EqualChar.equalsPre /my/server/url avgt 10 3.786 ± 0.027 ns/op |
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 characters
@BenchmarkMode(Mode.AverageTime) | |
@Fork(1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Measurement(iterations = 10, time = 1) | |
public class EqualChar { | |
@Param({"/", "/my/server/url"}) | |
private String url; |