mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8325169: Reduce String::indexOf overheads
Reviewed-by: rriggs, rgiulietti, mli
This commit is contained in:
parent
89e6a02e3b
commit
19e92201b4
4 changed files with 23 additions and 19 deletions
|
@ -40,7 +40,7 @@ import java.util.concurrent.TimeUnit;
|
|||
@State(Scope.Thread)
|
||||
@Warmup(iterations = 5, time = 1)
|
||||
@Measurement(iterations = 5, time = 1)
|
||||
@Fork(value = 1)
|
||||
@Fork(value = 3)
|
||||
public class StringIndexOf {
|
||||
|
||||
private String dataString;
|
||||
|
@ -111,6 +111,21 @@ public class StringIndexOf {
|
|||
return string16Short.indexOf(searchChar16);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int searchCharLongWithOffsetSuccess() {
|
||||
return dataStringBig.indexOf(searchChar, 3);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int searchCharMediumWithOffsetSuccess() {
|
||||
return searchStringBig.indexOf(searchChar, 3);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int searchCharShortWithOffsetSuccess() {
|
||||
return searchString.indexOf(searchChar, 1);
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public int searchChar16LongWithOffsetSuccess() {
|
||||
return string16Long.indexOf(searchChar16, 3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue