Skip to content

askama-rs/template-benchmark

Repository files navigation

Rust Template Benchmark

This benchmark tries to compare different template engines in Rust. We consider both precompiled and dynamic engines, which of course have wildly different runtime performances.

Beware: One engine might be faster than the other. But if the other engine is more ergonomical to work with, e.g. because you have no re-compilation times, then it might still be the better fit for you. Only you can decide which characteristics of a template engine (runtime speed, simplicity of programming, …) are important to you.

Currently, we compare 17 different template engines. All of them are well maintained, mature and perform HTML escaping automatically.

Crate Docs Repo Code Recent
Downloads
Github
Stars
Contrib-
utors
Recent
Commits
askama Image Image pre-compiled Image Image Image Image
dioxus Image Image ssr Image Image Image Image
handlebars Image Image interpreted Image Image Image Image
horrorshow Image Image pre-compiled Image Image Image Image
hypertext Image Image pre-compiled Image Image Image Image
leptos Image Image ssr Image Image Image Image
liquid Image Image interpreted Image Image Image Image
markup Image Image pre-compiled Image Image Image Image
maud Image Image pre-compiled Image Image Image Image
minijinja Image Image interpreted Image Image Image Image
ructe Image Image pre-compiled Image Image Image Image
sailfish Image Image pre-compiled Image Image Image Image
sycamore Image Image ssr Image Image Image Image
tera Image Image interpreted Image Image Image Image
tinytemplate Image Image interpreted Image Image Image Image
vy Image Image pre-compiled Image Image Image Image
yew Image Image ssr Image Image Image Image

Please see also Rust web framework comparison.

Benchmark Results

The benchmarking was done on Github's action runners, on an AMD-64 Linux system. The absolute performance can vary, but the relative performance of crate X to Y should be stable.

Image

More information can be found in: https://askama-rs.github.io/template-benchmark/.

The "big table" benchmark generates a 100×100 cell HTML table. The "teams" benchmark contains a list of four sport teams and their scores. The former test contains only raw data, but a lot of it. The latter test includes texts that (might) need escaping, and "if" conditions.

To run the benchmarks on your machine, clone the repo, and execute cargo bench. The console will contain performance numbers, and the file target/criterion/report/index.html will contain more information. Run ./generate-table.py to generate the table you see above.

Contributors 5