public class StringConstructBenchmark extends Object
The benchmark emphasizes on the build patterns that appear in the Calcite project.
| Modifier and Type | Class and Description |
|---|---|
static class |
StringConstructBenchmark.AppenderState
A state holding an Appendable object which is initialized after a fixed number of append
operations.
|
static class |
StringConstructBenchmark.WriterState
A state holding a Writer object which is initialized only once at the beginning of the
benchmark.
|
| Constructor and Description |
|---|
StringConstructBenchmark() |
| Modifier and Type | Method and Description |
|---|---|
void |
appendString(org.openjdk.jmh.infra.Blackhole bh,
StringConstructBenchmark.AppenderState appenderState)
Benchmarks the performance of instantiating different
Appendable objects and appending
the same string a fixed number of times. |
PrintWriter |
initPrintWriter(StringConstructBenchmark.WriterState writerState) |
StringBuilder |
initStringBuilder() |
StringWriter |
initStringWriter() |
static void |
main(String[] args) |
public StringBuilder initStringBuilder()
public StringWriter initStringWriter()
public PrintWriter initPrintWriter(StringConstructBenchmark.WriterState writerState)
public void appendString(org.openjdk.jmh.infra.Blackhole bh,
StringConstructBenchmark.AppenderState appenderState)
throws IOException
Appendable objects and appending
the same string a fixed number of times.bh - blackhole used as an optimization fenceappenderState - the state holds the type of the appender and the number of appends that
need to be performed before resetting the appenderIOException - if the append operation encounters an I/O problempublic static void main(String[] args) throws org.openjdk.jmh.runner.RunnerException
org.openjdk.jmh.runner.RunnerExceptionCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.