1
0
Fork 0
template_engine_comparison/README.md

92 lines
3.6 KiB
Markdown

# Template Engine Performance Comparison
#### Ruby implementations.
## Competitors
- Builder
- ERB
- Erubis
- Haml
- Liquid
- Markaby
- Mustache
- Slim
... and our special guest ...
- String interpolation
## Running
```bash
# Prepare workspace
git clone git@github.com:localhots/template_engine_comparison.git
cd template_engine_comparison
bundle install
# Generate data for templates
./fakedata.rb 1000 > data/big.yml
# Run benchmarks
./benchmark.rb
```
## Current Results
**Intel Core i7 2.6 GHz**
```
############################################################
## Compilation (small template) - 1.000 runs ##
############################################################
user system total real
string 0.030000 0.020000 0.050000 ( 0.044899)
erubis 0.060000 0.030000 0.090000 ( 0.086133)
erb 0.260000 0.020000 0.280000 ( 0.278659)
haml 0.840000 0.030000 0.870000 ( 0.869582)
slim 1.950000 0.030000 1.980000 ( 1.993040)
mustache 0.020000 0.020000 0.040000 ( 0.035736)
liquid 0.060000 0.020000 0.080000 ( 0.076226)
markaby 0.030000 0.010000 0.040000 ( 0.041241)
builder 0.020000 0.020000 0.040000 ( 0.041957)
############################################################
## Render (small template) - 10.000 runs ##
############################################################
user system total real
string 0.080000 0.010000 0.090000 ( 0.086388)
erubis 0.130000 0.010000 0.140000 ( 0.148000)
erb 0.120000 0.010000 0.130000 ( 0.117680)
haml 0.220000 0.000000 0.220000 ( 0.223524)
slim 0.270000 0.000000 0.270000 ( 0.268160)
mustache 2.380000 0.060000 2.440000 ( 2.448563)
liquid 0.380000 0.000000 0.380000 ( 0.392713)
markaby 2.410000 0.040000 2.450000 ( 2.441700)
builder 1.840000 0.010000 1.850000 ( 1.848402)
############################################################
## Compilation (big template) - 1.000 runs ##
############################################################
user system total real
string 0.030000 0.010000 0.040000 ( 0.044474)
erubis 0.160000 0.030000 0.190000 ( 0.183202)
erb 0.300000 0.020000 0.320000 ( 0.321878)
haml 1.160000 0.030000 1.190000 ( 1.193374)
slim 2.380000 0.040000 2.420000 ( 2.423795)
mustache 0.020000 0.020000 0.040000 ( 0.029639)
liquid 0.110000 0.020000 0.130000 ( 0.132466)
markaby 0.020000 0.010000 0.030000 ( 0.039952)
builder 0.030000 0.020000 0.050000 ( 0.043474)
############################################################
## Render (big template, 150KB data) - 50 runs ##
############################################################
user system total real
string 0.200000 0.030000 0.230000 ( 0.220962)
erubis 0.210000 0.010000 0.220000 ( 0.225647)
erb 0.310000 0.010000 0.320000 ( 0.321146)
haml 0.460000 0.010000 0.470000 ( 0.474801)
slim 0.710000 0.010000 0.720000 ( 0.717359)
mustache 1.900000 0.010000 1.910000 ( 1.909129)
liquid 5.230000 0.030000 5.260000 ( 5.265334)
markaby 5.760000 0.010000 5.770000 ( 5.766475)
builder 9.150000 0.020000 9.170000 ( 9.168262)
```