1
0
Fork 0
A study in Ruby template library performance
Go to file
Gregory Eremin babdc13c79
Add string interpolation
2013-12-14 03:04:31 +07:00
templates Add string interpolation 2013-12-14 03:04:31 +07:00
.gitignore Add big templates 2013-12-14 01:43:03 +07:00
Gemfile Slim, Liquid templates 2013-12-14 02:40:54 +07:00
Gemfile.lock Slim, Liquid templates 2013-12-14 02:40:54 +07:00
README.md Add string interpolation 2013-12-14 03:04:31 +07:00
benchmark.rb Add string interpolation 2013-12-14 03:04:31 +07:00
fakedata.rb Slim, Liquid templates 2013-12-14 02:40:54 +07:00

README.md

Template Engine Comparison

Running

# 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) (1000 runs)             ##
############################################################
                     user     system      total        real
string           0.040000   0.010000   0.050000 (  0.054310)
erb              0.240000   0.030000   0.270000 (  0.260111)
erubis           0.060000   0.010000   0.070000 (  0.078122)
haml             0.850000   0.030000   0.880000 (  0.873031)
slim             1.930000   0.030000   1.960000 (  1.960224)
liquid           0.050000   0.020000   0.070000 (  0.073867)

############################################################
##               Render (small) (1000 runs)               ##
############################################################
                     user     system      total        real
string           0.010000   0.000000   0.010000 (  0.013322)
erb              0.010000   0.000000   0.010000 (  0.012137)
erubis           0.010000   0.000000   0.010000 (  0.008176)
haml             0.020000   0.000000   0.020000 (  0.021298)
slim             0.020000   0.000000   0.020000 (  0.022210)
liquid           0.030000   0.000000   0.030000 (  0.036494)

############################################################
##             Compilation (big) (1000 runs)              ##
############################################################
                     user     system      total        real
string           0.060000   0.020000   0.080000 (  0.071830)
erb              0.300000   0.020000   0.320000 (  0.324309)
erubis           0.120000   0.020000   0.140000 (  0.140036)
haml             1.180000   0.030000   1.210000 (  1.203810)
slim             2.410000   0.030000   2.440000 (  2.441857)
liquid           0.120000   0.010000   0.130000 (  0.134647)

############################################################
##                Render (big) (100 runs)                 ##
############################################################
                     user     system      total        real
string           0.390000   0.030000   0.420000 (  0.414645)
erb              0.650000   0.020000   0.670000 (  0.666250)
erubis           0.430000   0.010000   0.440000 (  0.448594)
haml             0.970000   0.020000   0.990000 (  0.981991)
slim             1.400000   0.010000   1.410000 (  1.408893)
liquid          10.480000   0.050000  10.530000 ( 10.535895)