Benchmark
The benchmark is based on generating HTML output for some reasons:
- Web apps are used concurrently by many clients, i.e. performance really matters1.
- Most other template engines are focused on HTML, i.e. here one has the most engines to choose from.
Table of Contents
The Domain Model
To see some real-word work done the benchmark is based on a domain model that is slightly more challenging that the typical "list of domain object" task. We will use a simple address book example:
What is measured
The focus of the benchmark shall be the pure rendering performance of the template engine, i.e. we are not interested in request handling time, network latency or anything else that is out of scope of the template engine. As rendering we consider the process of writing the output. The resulting web page will look like this example. Not very pretty but it will suite our needs.
Benchmarks
Configuration
The benchmark was locally executed on the following setup:
Web Container | Apache Tomcat/7.0.21 |
JVM Version | 1.7.0_09-b05 |
JVM Vendor | Oracle |
OS Name | Linux |
OS Version | 3.2.0-4-amd64 |
OS Architecture | amd64 |
Result
The benchmark captured the minimum, maximum and average rendering time of 50 HTTP requests:
Test | Calls | min. [msec] | avg. [msec] | max. [msec] |
---|---|---|---|---|
Toxic | 50 | 0.89 | 1.55 | 2.53 |
JSP | 50 | 0.91 | 2.30 | 9.76 |
Don't overestimate this benchmark! It's a quick and dirty hack without too much background research. The intent is to see if Toxic's performance is comparable to others.
Footnotes:
1 OK, if only the template engine is efficient in an environment as complex as a web container this won't help. But if each of the components doesn't care for efficiency for the "me alone cannot fix it" argument you will end up with the sum of all inefficiencies.
Date: May 25, 2014
HTML generated with emacs org-mode & Toxic by [qb]