JMH benchmark of the most popular Java template engines
Java HTML Gnuplot
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore Added eclipse .project file to gitignore Mar 2, 2015
LICENSE First commit Feb 25, 2015 Added rocker Nov 6, 2015
benchmark.plot Renamed benchmarks and added a gnuplot script file to make plots Mar 2, 2015
pom.xml Updated pebble to latest version Mar 9, 2016
results.csv update benchmarks results Nov 22, 2015
results.png update benchmarks results Nov 22, 2015


JMH benchmark for popular Java template engines:

Running the benchmark

  1. Download the source code and build it (mvn clean install)
  2. Run the entire benchmark suite with java -jar target/benchmarks.jar
  3. (Optional) To run a single benchmark, such as Mustache, use java -jar target/benchmarks.jar Mustache

Generating plot

  1. Run benchmark while exporting results to csv with java -jar target/benchmarks.jar -rff results.csv -rf csv
  2. Use gnuplot to generate plot with gnuplot benchmark.plot. This will output results.png.

Rules of Template Engine Configuration

It is imperative that each template engine is configured in way to reflect real-world usage as opposed to it's optimal configuration. Typically this means an out-of-the-box configuration.

To strive for a common set of features across template engines, the following configurations are expected:

  • Disabling of HTML escaping
  • Template loaded from classpath prior to actual benchmark

Interpreting the Results

The benchmarks measure throughput, given in "ops/time". The time unit used is seconds. Generally, the score represents the number of templates rendered per second; the higher the score, the better.

Example Results

Template Comparison