Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.
  • maud: A Compile-time HTML template engine for Rust.
  • sailfish: Simple, small, and extremely fast template engine for Rust

Results

These results are from 2020-12-22 (rustc 1.48.0), running on an Intel Xeon W-3275M CPU. Your mileage may vary.

As a violin plot generated by Criterion:

Big table violin plot Teams violin plot

Numbers, as output by Criterion:

Big table/Askama        time:   [484.58 us 486.44 us 488.37 us]
Big table/fomat         time:   [262.20 us 263.10 us 264.04 us]
Big table/Handlebars    time:   [12.691 ms 12.733 ms 12.776 ms]
Big table/Horrorshow    time:   [273.87 us 275.10 us 276.42 us]
Big table/Liquid        time:   [15.379 ms 15.432 ms 15.490 ms]
Big table/Markup        time:   [91.338 us 91.795 us 92.267 us]
Big table/Maud          time:   [271.04 us 271.96 us 272.93 us]
Big table/Ructe         time:   [387.36 us 389.06 us 390.86 us]
Big table/Sailfish      time:   [30.327 us 30.451 us 30.591 us]
Big table/Tera          time:   [3.3310 ms 3.3435 ms 3.3555 ms]
Big table/write         time:   [337.27 us 339.34 us 341.40 us]

Teams/Askama            time:   [856.63 ns 858.46 ns 860.38 ns]
Teams/fomat             time:   [484.51 ns 489.05 ns 493.23 ns]
Teams/Handlebars        time:   [11.853 us 11.907 us 11.961 us]
Teams/Horrorshow        time:   [487.49 ns 490.78 ns 494.48 ns]
Teams/Liquid            time:   [12.125 us 12.174 us 12.227 us]
Teams/Markup            time:   [225.04 ns 227.59 ns 229.97 ns]
Teams/Maud              time:   [410.93 ns 413.28 ns 415.67 ns]
Teams/Ructe             time:   [864.70 ns 874.37 ns 884.52 ns]
Teams/Sailfish          time:   [144.05 ns 145.25 ns 146.72 ns]
Teams/Tera              time:   [7.8097 us 7.8556 us 7.9058 us]
Teams/write             time:   [697.02 ns 702.11 ns 708.27 ns]

Running the benchmarks

$ cargo bench

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

About

Collected benchmarks for templating crates written in Rust

Resources

Releases

No releases published

Packages

No packages published