Class StringConstructBenchmark


  • public class StringConstructBenchmark
    extends java.lang.Object
    A benchmark of the most common patterns that are used to construct gradually String objects.

    The benchmark emphasizes on the build patterns that appear in the Calcite project.

    • Constructor Detail

      • StringConstructBenchmark

        public StringConstructBenchmark()
    • Method Detail

      • initStringBuilder

        public java.lang.StringBuilder initStringBuilder()
      • initStringWriter

        public java.io.StringWriter initStringWriter()
      • appendString

        public void appendString​(org.openjdk.jmh.infra.Blackhole bh,
                                 StringConstructBenchmark.AppenderState appenderState)
                          throws java.io.IOException
        Benchmarks the performance of instantiating different Appendable objects and appending the same string a fixed number of times.
        Parameters:
        bh - blackhole used as an optimization fence
        appenderState - the state holds the type of the appender and the number of appends that need to be performed before resetting the appender
        Throws:
        java.io.IOException - if the append operation encounters an I/O problem
      • main

        public static void main​(java.lang.String[] args)
                         throws org.openjdk.jmh.runner.RunnerException
        Throws:
        org.openjdk.jmh.runner.RunnerException