1
0
2013-12-14 04:12:26 +07:00
2013-12-14 01:43:03 +07:00
2013-12-14 04:12:26 +07:00
2013-12-14 02:40:54 +07:00
2013-12-14 04:12:26 +07:00
2013-12-14 04:12:26 +07:00
2013-12-14 04:12:26 +07:00

Template Engine Performance Comparison

Ruby implementations.

Competitors

  • Builder
  • ERB
  • Erubis
  • Haml
  • Liquid
  • Markaby
  • Mustache
  • Slim

... and our special guest ...

  • String interpolation

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.030000   0.020000   0.050000 (  0.046353)
erubis           0.060000   0.020000   0.080000 (  0.079977)
erb              0.260000   0.020000   0.280000 (  0.273492)
haml             0.850000   0.020000   0.870000 (  0.874163)
slim             1.970000   0.040000   2.010000 (  2.003406)
mustache         0.020000   0.010000   0.030000 (  0.034893)
liquid           0.050000   0.020000   0.070000 (  0.074104)
markaby          0.030000   0.020000   0.050000 (  0.039915)
builder          0.020000   0.010000   0.030000 (  0.039993)

############################################################
##               Render (small) (1000 runs)               ##
############################################################
                     user     system      total        real
string           0.010000   0.000000   0.010000 (  0.009001)
erubis           0.010000   0.000000   0.010000 (  0.008587)
erb              0.010000   0.000000   0.010000 (  0.012027)
haml             0.020000   0.010000   0.030000 (  0.022236)
slim             0.020000   0.000000   0.020000 (  0.021628)
mustache         0.250000   0.000000   0.250000 (  0.257850)
liquid           0.050000   0.000000   0.050000 (  0.045442)
markaby          0.230000   0.000000   0.230000 (  0.232095)
builder          0.200000   0.000000   0.200000 (  0.196965)

############################################################
##             Compilation (big) (1000 runs)              ##
############################################################
                     user     system      total        real
string           0.030000   0.020000   0.050000 (  0.043935)
erubis           0.150000   0.020000   0.170000 (  0.176325)
erb              0.310000   0.020000   0.330000 (  0.325486)
haml             1.190000   0.030000   1.220000 (  1.217889)
slim             2.430000   0.030000   2.460000 (  2.468188)
mustache         0.020000   0.020000   0.040000 (  0.031460)
liquid           0.110000   0.020000   0.130000 (  0.134760)
markaby          0.030000   0.010000   0.040000 (  0.039455)
builder          0.020000   0.020000   0.040000 (  0.040826)

############################################################
##                Render (big) (100 runs)                 ##
############################################################
                     user     system      total        real
string           0.370000   0.020000   0.390000 (  0.392442)
erubis           0.450000   0.020000   0.470000 (  0.463274)
erb              0.630000   0.020000   0.650000 (  0.651563)
haml             0.970000   0.010000   0.980000 (  0.982174)
slim             1.410000   0.010000   1.420000 (  1.422800)
mustache         3.760000   0.000000   3.760000 (  3.757236)
liquid          10.440000   0.040000  10.480000 ( 10.480874)
markaby         11.560000   0.020000  11.580000 ( 11.576669)
builder         18.300000   0.030000  18.330000 ( 18.326396)
Description
A study in Ruby template library performance
Readme 65 KiB
Languages
Ruby 59.2%
HTML 7.4%
Liquid 7.2%
Mustache 6.8%
Handlebars 6.6%
Other 12.8%