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
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 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 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 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 (url) Mode Cnt Score Error Units | |
StartsWith.regionMatches http://facebook.com/loginMe avgt 10 5.025 ± 0.032 ns/op | |
StartsWith.substringEqualsIgnoreCase http://facebook.com/loginMe avgt 10 19.390 ± 0.922 ns/op | |
StartsWith.toLowerCaseStartsWith http://facebook.com/loginMe avgt 10 40.815 ± 0.550 ns/op | |
StartsWith.regionMatches Http://facebook.com/loginMe avgt 10 14.469 ± 0.164 ns/op | |
StartsWith.substringEqualsIgnoreCase Http://facebook.com/loginMe avgt 10 21.758 ± 0.304 ns/op | |
StartsWith.toLowerCaseStartsWith Http://facebook.com/loginMe avgt 10 46.457 ± 0.643 ns/op |
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
public boolean equalsIgnoreCase(String anotherString) { | |
return (this == anotherString) ? true | |
: (anotherString != null) | |
&& (anotherString.length() == length()) | |
&& regionMatches(true, 0, anotherString, 0, length()); | |
} |
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(value = 1) | |
@State(Scope.Thread) | |
@Warmup(iterations = 5, time = 1) | |
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |
@Measurement(iterations = 10, time = 1) | |
public class StringBuilderChaining { | |
@Param({"sum"}) | |
private String leftFunction; |
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
StringBuilder expression = new StringBuilder(); | |
expression.append(leftFunction).append("("); | |
expression.append(alias).append("."); | |
expression.append(left).append(")"); | |
expression.append(" ").append(op).append(" "); | |
expression.append(":").append(paramName); | |
return expression.toString(); |
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
return new StringBuilder() | |
.append(leftFunction).append("(") | |
.append(alias).append(".") | |
.append(left).append(")") | |
.append(" ").append(op).append(" ") | |
.append(":").append(paramName) | |
.toString(); |
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
return leftFunction + "(" | |
+ alias + "." | |
+ left + ")" | |
+ " " + op + " " | |
+ ":" + paramName; |
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
JDK 11.0.8, OpenJDK 64-Bit Server VM, 11.0.8+10 | |
Benchmark Mode Cnt Score Error Units | |
StringBuilderChaining.chainingStringBuilder avgt 10 51.790 ± 0.889 ns/op | |
StringBuilderChaining.concatMethod avgt 10 144.281 ± 5.302 ns/op | |
StringBuilderChaining.explicitConcat avgt 10 46.840 ± 0.460 ns/op | |
StringBuilderChaining.noChainingStringBuilder avgt 10 73.528 ± 1.534 ns/op |