Skip to content

Commit 0164bca

Browse files
author
Rohitash Kumar
committed
improve jmh benchmark
1 parent 07bff28 commit 0164bca

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/micro/org/openjdk/bench/java/net/URIAuthorityParsingBenchmark.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import org.openjdk.jmh.annotations.Fork;
2626
import org.openjdk.jmh.annotations.Measurement;
27+
import org.openjdk.jmh.annotations.Param;
2728
import org.openjdk.jmh.annotations.State;
2829
import org.openjdk.jmh.annotations.Scope;
2930
import org.openjdk.jmh.annotations.Benchmark;
@@ -47,16 +48,15 @@
4748
@Fork(value = 3)
4849
public class URIAuthorityParsingBenchmark {
4950

50-
private final String NUMERIC_HOST_URI = "https://98765432101.abc.xyz.com";
51-
private final String STANDARD_HOST_URI = "https://xxxxx.abc.xyz.com";
51+
@Param({
52+
"https://98765432101.abc.xyz.com",
53+
"https://ABCDEFGHIJK.abc.xyz.com"
54+
})
55+
private String uri;
5256

5357
@Benchmark
54-
public void createUriWithNumericHostPrefix(Blackhole blackhole) {
55-
blackhole.consume(URI.create(NUMERIC_HOST_URI));
58+
public void create(Blackhole blackhole) {
59+
blackhole.consume(URI.create(uri));
5660
}
5761

58-
@Benchmark
59-
public void createUriWithStandardHost(Blackhole blackhole) {
60-
blackhole.consume(URI.create(STANDARD_HOST_URI));
61-
}
6262
}

0 commit comments

Comments
 (0)