1
0
Fork 0
template_engine_comparison/README.md

92 lines
3.6 KiB
Markdown
Raw Normal View History

2013-12-13 20:29:37 +00:00
# Template Engine Performance Comparison
#### Ruby implementations.
## Competitors
2013-12-13 21:12:26 +00:00
- Builder
2013-12-13 20:29:37 +00:00
- ERB
- Erubis
- Haml
- Liquid
2013-12-13 21:12:26 +00:00
- Markaby
2013-12-13 20:29:37 +00:00
- Mustache
- Slim
2013-12-13 21:12:26 +00:00
2013-12-13 20:29:37 +00:00
... and our special guest ...
2013-12-13 21:12:26 +00:00
2013-12-13 20:29:37 +00:00
- String interpolation
2013-12-13 06:42:27 +00:00
## Running
2013-12-13 18:43:03 +00:00
```bash
# Prepare workspace
2013-12-13 06:42:27 +00:00
git clone git@github.com:localhots/template_engine_comparison.git
cd template_engine_comparison
bundle install
2013-12-13 18:43:03 +00:00
# Generate data for templates
2013-12-13 19:40:54 +00:00
./fakedata.rb 1000 > data/big.yml
2013-12-13 18:43:03 +00:00
# Run benchmarks
2013-12-13 06:42:27 +00:00
./benchmark.rb
```
## Current Results
2013-12-13 20:29:37 +00:00
**Intel Core i7 2.6 GHz**
2013-12-13 20:04:31 +00:00
2013-12-13 06:42:27 +00:00
```
############################################################
2013-12-13 21:21:46 +00:00
## Compilation (small template) - 1.000 runs ##
2013-12-13 06:42:27 +00:00
############################################################
user system total real
2013-12-14 17:47:11 +00:00
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)
2013-12-13 06:42:27 +00:00
############################################################
2013-12-13 21:21:46 +00:00
## Render (small template) - 10.000 runs ##
2013-12-13 06:42:27 +00:00
############################################################
user system total real
2013-12-14 17:47:11 +00:00
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)
2013-12-13 19:40:54 +00:00
############################################################
2013-12-13 21:21:46 +00:00
## Compilation (big template) - 1.000 runs ##
2013-12-13 19:40:54 +00:00
############################################################
user system total real
2013-12-14 17:47:11 +00:00
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)
2013-12-13 19:40:54 +00:00
############################################################
2013-12-14 17:47:11 +00:00
## Render (big template, 150KB data) - 50 runs ##
2013-12-13 19:40:54 +00:00
############################################################
user system total real
2013-12-14 17:47:11 +00:00
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)
2013-12-13 06:42:27 +00:00
```