Skip to content
Collected benchmarks for templating crates written in Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benches
src
templates
templates_ructe
.gitignore
Cargo.toml
README.md
big-table.svg
teams.svg

README.md

Rust template engine benchmarks

This repo tries to assess Rust template engine performance. Following the download ratings from crates.io, these nine projects are assessed:

  • write!: the std library write! macro
  • Handlebars: Handlebars templating implemented in Rust
  • Tera: template engine based on Jinja2/Django templates
  • Liquid: the liquid templating language for Rust
  • Askama: type-safe, compiled Jinja-like templates for Rust
  • horrorshow: a templating library written in rust macros
  • ructe: Rust Compiled Templates, efficient type-safe web page templates
  • fomat: alternative syntax for print/write/format-like macros with a small templating language
  • markup: A blazing fast, type-safe template engine for Rust.

Results

As a violin plot generated by Criterion:

Big table violin plot Teams violin plot

Numbers, as output by Criterion:

Big table/Askama        time:   [633.96 us 637.64 us 642.44 us]
Big table/fomat         time:   [373.34 us 374.90 us 376.72 us]
Big table/Handlebars    time:   [72.017 ms 72.110 ms 72.222 ms]
Big table/Horrorshow    time:   [346.48 us 348.37 us 351.12 us]
Big table/Liquid        time:   [12.152 ms 12.180 ms 12.213 ms]
Big table/Markup        time:   [253.78 us 254.08 us 254.40 us]
Big table/Ructe         time:   [618.98 us 623.51 us 630.23 us]
Big table/Tera          time:   [3.8208 ms 3.8350 ms 3.8492 ms]
Big table/write         time:   [328.19 us 328.66 us 329.13 us]

Teams/Askama            time:   [1.0681 us 1.0801 us 1.0916 us]
Teams/fomat             time:   [680.61 ns 684.25 ns 687.99 ns]
Teams/Handlebars        time:   [51.387 us 51.567 us 51.793 us]
Teams/Horrorshow        time:   [515.99 ns 518.41 ns 521.02 ns]
Teams/Liquid            time:   [13.848 us 13.885 us 13.923 us]
Teams/Markup            time:   [827.98 ns 856.04 ns 884.41 ns]
Teams/Ructe             time:   [1.0893 us 1.1180 us 1.1458 us]
Teams/Tera              time:   [13.220 us 13.271 us 13.325 us]
Teams/write             time:   [769.58 ns 787.58 ns 806.07 ns]

Running the benchmarks

$ cargo bench

Plots will be rendered if gnuplot is installed and will be available in the target/criterion folder.

You can’t perform that action at this time.