1
0
Fork 0
template_engine_comparison/README.md

80 lines
3.1 KiB
Markdown
Raw Normal View History

2013-12-13 20:29:37 +00:00
# Template Engine Performance Comparison
#### Ruby implementations.
## Competitors
- ERB
- Erubis
- Haml
- Liquid
- Mustache
- Slim
... and our special guest ...
- 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 19:40:54 +00:00
## Compilation (small) (1000 runs) ##
2013-12-13 06:42:27 +00:00
############################################################
user system total real
2013-12-13 20:29:37 +00:00
string 0.040000 0.020000 0.060000 ( 0.053855)
erubis 0.060000 0.010000 0.070000 ( 0.075751)
erb 0.240000 0.030000 0.270000 ( 0.262077)
haml 0.840000 0.020000 0.860000 ( 0.865688)
slim 1.930000 0.040000 1.970000 ( 1.968993)
mustache 0.020000 0.010000 0.030000 ( 0.030289)
liquid 0.080000 0.020000 0.100000 ( 0.104174)
2013-12-13 06:42:27 +00:00
############################################################
2013-12-13 19:40:54 +00:00
## Render (small) (1000 runs) ##
2013-12-13 06:42:27 +00:00
############################################################
user system total real
2013-12-13 20:29:37 +00:00
string 0.010000 0.000000 0.010000 ( 0.007824)
erubis 0.010000 0.000000 0.010000 ( 0.008019)
erb 0.010000 0.000000 0.010000 ( 0.010448)
haml 0.020000 0.000000 0.020000 ( 0.019507)
slim 0.020000 0.000000 0.020000 ( 0.019644)
mustache 0.230000 0.000000 0.230000 ( 0.232938)
liquid 0.040000 0.000000 0.040000 ( 0.044189)
2013-12-13 19:40:54 +00:00
############################################################
## Compilation (big) (1000 runs) ##
############################################################
user system total real
2013-12-13 20:29:37 +00:00
string 0.030000 0.020000 0.050000 ( 0.044706)
erubis 0.140000 0.020000 0.160000 ( 0.161244)
erb 0.320000 0.030000 0.350000 ( 0.341144)
haml 1.180000 0.020000 1.200000 ( 1.205595)
slim 2.410000 0.040000 2.450000 ( 2.449355)
mustache 0.020000 0.010000 0.030000 ( 0.028152)
liquid 0.110000 0.020000 0.130000 ( 0.133382)
2013-12-13 19:40:54 +00:00
############################################################
2013-12-13 20:04:31 +00:00
## Render (big) (100 runs) ##
2013-12-13 19:40:54 +00:00
############################################################
user system total real
2013-12-13 20:29:37 +00:00
string 0.390000 0.020000 0.410000 ( 0.408272)
erubis 0.440000 0.020000 0.460000 ( 0.457214)
erb 0.640000 0.020000 0.660000 ( 0.656181)
haml 0.940000 0.020000 0.960000 ( 0.965373)
slim 1.390000 0.000000 1.390000 ( 1.395409)
mustache 3.770000 0.010000 3.780000 ( 3.778392)
liquid 10.460000 0.050000 10.510000 ( 10.507224)
2013-12-13 06:42:27 +00:00
```