My company is currently working on a project based on Thymeleaf 2.1.4. In the forum we found an announcement that Thymeleaf 3 is coming and so we asked ourselves how big the performance change will be between Thymeleaf 2.x and Thymeleaf 3.x.

Also there was a comment about a speed change from 1000 pages per second to 11000 pages per second, but there was no comparison to other template frameworks like Mustache or Freemaker. Therefore we will do a small comparison here.

Benchmark software

For this case we use the template benchmark created by Mitchell Bösecke. The nice thing about this benchmark is, that it also has a few warmup rounds, so that the JVM returns „real“ results.

Note: We have used a SNAPSHOT version, which is something like a alpha/beta version. Therefore treat the results with caution.

Testing machine: Macbook Pro Retina 13 with 8GB RAM and Intel Core i5 with 2.6 GHz.

Benchmark with Thymeleaf 2.1.4.RELEASE

Freemarker.benchmarkthrpt5012731,812± 145,537ops/s
Mustache.benchmarkthrpt5018222,71± 205,985ops/s
Pebble.benchmarkthrpt5027371,882± 392,471ops/s
Thymeleaf.benchmarkthrpt501047,699± 32,821ops/s
Trimou.benchmarkthrpt5014395,23± 535,186ops/s
Velocity.benchmarkthrpt5016366,856± 209,496ops/s

Benchmark with Thymeleaf 3.0 Snapshot

Freemarker.benchmarkthrpt5013134,939± 304,043ops/s
Mustache.benchmarkthrpt5018827,112± 181,07ops/s
Pebble.benchmarkthrpt5027697,279± 683,000ops/s
Thymeleaf.benchmarkthrpt502943,03± 231,809ops/s
Trimou.benchmarkthrpt5015062,598± 191,149ops/s
Velocity.benchmarkthrpt5016142,213± 649,104ops/s


In our case the benchmark shows an improvement of Thymeleaf 3.0 (Snapshot) being nearly 3 times faster than Thymeleaf 2.1.4. In comparison to the other template engines Thymeleaf is in this use case still slow ;-)