mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8247681: Improve bootstrapping of unary concatenations
Reviewed-by: jlaskey, psandoz
This commit is contained in:
parent
1d87958ead
commit
34c79640e7
6 changed files with 149 additions and 19 deletions
|
@ -24,11 +24,14 @@ package org.openjdk.bench.java.lang;
|
|||
|
||||
import org.openjdk.jmh.annotations.Benchmark;
|
||||
import org.openjdk.jmh.annotations.BenchmarkMode;
|
||||
import org.openjdk.jmh.annotations.Fork;
|
||||
import org.openjdk.jmh.annotations.Measurement;
|
||||
import org.openjdk.jmh.annotations.Mode;
|
||||
import org.openjdk.jmh.annotations.OutputTimeUnit;
|
||||
import org.openjdk.jmh.annotations.Param;
|
||||
import org.openjdk.jmh.annotations.Scope;
|
||||
import org.openjdk.jmh.annotations.State;
|
||||
import org.openjdk.jmh.annotations.Warmup;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -38,6 +41,9 @@ import java.util.concurrent.TimeUnit;
|
|||
@BenchmarkMode(Mode.AverageTime)
|
||||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||
@State(Scope.Thread)
|
||||
@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
|
||||
@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
|
||||
@Fork(3)
|
||||
public class StringConcat {
|
||||
|
||||
@Param("4711")
|
||||
|
@ -73,6 +79,16 @@ public class StringConcat {
|
|||
return emptyString + stringValue;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public String concatEmptyConstInt() {
|
||||
return "" + intValue;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public String concatEmptyConstString() {
|
||||
return "" + stringValue;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public String concatMethodConstString() {
|
||||
return "string".concat(stringValue);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue