tree: e522a0b15100f4830dbad41ca253ca5dc076274c [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.md
benchmark/README.md

Benchmark module

This module contains benchmarks written using JMH from OpenJDK.

Preparation using the Ghent PDF Output Suite V50

As the Ghent PDF Output Suite V50 can not be downloaded automatically as a license has to be agreed on the following steps need to be done prior to running Rendering.renderGhentCMYK:

  • select Download on the download page
  • unpack the ZIP file in the directory target/pdfs so that the directory Ghent_PDF_Output_Suite_V50_Full is on top
  • keep only Ghent_PDF_Output_Suite_V50_Full/Categories/1-CMYK/Test pages/Ghent_PDF-Output-Test-V50_CMYK_X4.pdf

Running benchmarks

The default behavior is to run all benchmarks:

java -jar target/benchmarks.jar

List all available benchmarks:

java -jar target/benchmarks.jar -l

Pass a pattern or name after the command to select the benchmarks:

java -jar target/benchmarks.jar LoadAndSave.loadMediumFile

Check which benchmarks match the provided pattern:

java -jar target/benchmarks.jar -l LoadAndSave

Run a specific test and override the number of forks, iterations and warm-up iteration to 2:

java -jar target/benchmarks.jar  -f 2 -i 2 -wi 2 LoadAndSave.loadMediumFile

Get a list of available profilers:

java -jar target/benchmarks.jar -lprof

The following sections cover async profiler and GC profilers in more detail.

Using JMH with async-profiler

JMH includes async-profiler. After download run JMH using the async-profiler:

java -jar target/benchmarks.jar -prof async:libPath=/path/to/libasyncProfiler.so

With flame graph output (the semicolon is escaped to ensure it is not treated as a command separator):

java -jar target/benchmarks.jar -prof async:libPath=/path/to/libasyncProfiler.so\;output=flamegraph

To get help on options to be used for the async-profiler use the following command:

java -jar target/benchmarks.jar -prof async:help

Using JMH with GC profiler

To measure the allocation rate run the benchmark with -prof gc:

java -jar target/benchmarks.jar -prof gc

For profiling the norm alloc rates are important as this which measure the allocations per operation rather than allocations per second which can increase/decrease with faster/slower code.

Writing benchmarks

Examples for writing JMH tests are available from the projects samples provided by the JMH project.

Tutorials are available at