is there any java template engine benchmarks?

rocker java template engine
java lightweight template engine
spring comparing template engines
spring template engine
freemarker vs velocity
freemarker dynamic template
xml template engine
mustache template java example

I'm looking for fastest and reliable java template engine. Is there any benchmarks for microseconds capable template engines?

I've found engines: http://code.google.com/p/mist4j/wiki/USAGE http://lazyj.sourceforge.net/

Scrpting languages template benchmarks http://www.kuwata-lab.com/tenjin/ there velocity sucks.

I'm also interested in compare of ability of engines found and freemarker and StringTemplate engines.

I ran for 10000 times loop. Rythm was failing to load template, so i need to exclude that in my test...

stringbuilder: [java] ntimes: 10000, real time: 641(msec)

freemarker: [java] ntimes: 10000, real time: 1602(msec)

velocity: [java] ntimes: 10000, real time: 1035(msec)

jamon: [java] ntimes: 10000, real time: 633(msec)

httl: [java] ntimes: 10000, real time: 479(msec)

jmte: [java] ntimes: 10000, real time: 2193(msec)

httl was outperforming in all tests with 100 time loop, 1000 time loop and finally 10000 loop (also mentioned above).

is there any java template engine benchmarks?, JMH benchmark of the most popular Java template engines To run a single benchmark, such as Mustache, use java -jar target/benchmarks.jar MustacheĀ  ===== JAVA TEMPLATE ENGINE BENCHMARKER v1.0 ===== This is a benchmark program for a collection of Java template engines: * stringbuilder - the baseline. manually created page using StringBulder * freemarker - v2.3.19 * velocity - v1.7 * rythm - v1.0-b2 * httl - 1.0.7 * beetl - 1.2 * jamon - 2.3 * jangod - no version info * thymeleaf - 2.0.15 * mustache - 0.8.12 * handlebars - 2.2.0 You need apache ant to run the program, just type "ant" and it will start.

mbosecke/template-benchmark: JMH benchmark of the , Performance testing server side rendering using java template engines + Spring Boot and some learnings on the way. This article is aboutĀ  ===== JAVA TEMPLATE ENGINE BENCHMARKER jdk8 ===== This is a benchmark program for a collection of Java template engines: * stringbuilder - the baseline. manually created page using StringBulder * freemarker * velocity * rythm * httl * beetl * jamon * jangod * thymeleaf * mustache.java * jmustache * handlebars The versions of template engines can be deduced by looking in the lib directory.

Here's a good benchmark for java template engines

https://github.com/jreijn/spring-comparing-template-engines

According to it:

Jade4j                  567.7 seconds
Handlebars              147.7 seconds
Scalate - Scaml         33.33 seconds
Pebble                  27.92 seconds
HTTL                    24.61 seconds
Thymeleaf               24.09 seconds
Velocity                23.07 seconds
Freemarker              11.80 seconds
jTwig                   10.95 seconds
Mustache (JMustache)    8.836 seconds
JSP                     7.888 seconds

The best part is: You can reproduce the benchmark yourself and verify the results :)

Learnings while benchmarking Java Template Engine with Spring , easier to use and the resulting web pages are easier to understand. template-benchmark. JMH benchmark for popular Java template engines: Freemarker; Mustache; Pebble; Rocker; Thymeleaf; Trimou; Velocity; Running the benchmark. Download the source code and build it (mvn clean install) Run the entire benchmark suite with java -jar target/benchmarks.jar (Optional) To run a single benchmark, such as Mustache, use java -jar target/benchmarks.jar Mustache

FreeMarker Java Template Engine, itself has been promoting thymeleaf via several thymeleaf based projects and examples in its blog. ===== JAVA TEMPLATE ENGINE BENCHMARKER v1.0 ===== This is a benchmark program for a collection of Java template engines: * stringbuilder - the baseline. manually created page using StringBulder * freemarker - v2.3.19 * velocity - v1.7 * rythm - v1.0-b2 * httl - 1.0.7 * beetl - 1.2 * jamon - 2.3 * jangod - no version info * thymeleaf - 2.0.15 You need apache ant to run the program, just type "ant" and it will start.

Java Template Engines, to create a web application. It provides a good support for serving a XHTML/HTML5 in web applications. template-benchmark. JMH benchmark for popular Java template engines: Freemarker; Mustache; Pebble; Rocker; Thymeleaf; Trimou; Velocity; Running the benchmark. Download the source code and build it (mvn clean install) Run the entire benchmark suite with java -jar target/benchmarks.jar (Optional) To run a single benchmark, such as Mustache, use java -jar target/benchmarks.jar Mustache

Server Side Templating in Spring Boot using Thymeleaf, To give a better overview of these template engines, here's a table Java Microbenchmark Harness, which is a Java tool to benchmark code. A Review of Java Template Engines DZone 's Guide to In this article, Miro Kopecky provides a thorough review of Java template engines Apache Velocity, Apache FreeMarker, Thymeleaf, and Pebble.

Comments
  • Last I seen it (and it certainly didn't change) Velocity wasn't compiled to anything, it just runs the AST directly. And the AST nodes will use Map.get and reflection to get the values. FreeMarker does the same (that I'm sure of), and it should be slower as it has to do more (more features). OTOH template languages written for "script languages" (like Python) often transform to the host script language, and then the alredy highly tuned script language implementation (like CPython) will do its magic... hence the speed difference.
  • can you test for StringTemplate as well? or share how can one do it for newer template engines?
  • Interesting benchmark, but I wonder why don't you publish your results. Maybe I'm a bit too lazy :)
  • The thing is template engine is updating, and result might not be relevant to new versions. So it's better for you to pickup latest version of each template engine jar file, put them into the lib folder and run the benchmark. Anyway here you can find a snapshot of the benchmark result: rythmengine.org/doc/feature#high-performance
  • Thanks. I think this way we can get an idea of the numbers, although they can change a little over time.
  • This benchmark is missing Handlebars and Mustache, but there's a fork (with a languishing pull request) where they've been added: github.com/agentgt/template-engine-benchmarks