1
0
Fork 0
A study in Ruby template library performance
Go to file
Gregory Eremin 5940fce015 Adjust benchmarks, prettify results 2013-12-14 04:23:23 +07:00
templates Add Builder and Markaby 2013-12-14 04:12:26 +07:00
.gitignore Add big templates 2013-12-14 01:43:03 +07:00
Gemfile Add Builder and Markaby 2013-12-14 04:12:26 +07:00
Gemfile.lock Add Builder and Markaby 2013-12-14 04:12:26 +07:00
README.md Adjust benchmarks, prettify results 2013-12-14 04:23:23 +07:00
benchmark.rb Adjust benchmarks, prettify results 2013-12-14 04:23:23 +07:00
fakedata.rb Slim, Liquid templates 2013-12-14 02:40:54 +07:00

README.md

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 template) - 1.000 runs        ##
############################################################
                     user     system      total        real
string           0.020000   0.020000   0.040000 (  0.043484)
erubis           0.060000   0.020000   0.080000 (  0.079481)
erb              0.250000   0.020000   0.270000 (  0.266557)
haml             0.850000   0.030000   0.880000 (  0.879533)
slim             1.970000   0.030000   2.000000 (  2.004234)
mustache         0.030000   0.020000   0.050000 (  0.047097)
liquid           0.060000   0.010000   0.070000 (  0.072771)
markaby          0.020000   0.020000   0.040000 (  0.037510)
builder          0.020000   0.020000   0.040000 (  0.039034)

############################################################
##         Render (small template) - 10.000 runs          ##
############################################################
                     user     system      total        real
string           0.080000   0.000000   0.080000 (  0.085994)
erubis           0.090000   0.000000   0.090000 (  0.094257)
erb              0.140000   0.010000   0.150000 (  0.139963)
haml             0.220000   0.000000   0.220000 (  0.221741)
slim             0.220000   0.000000   0.220000 (  0.218883)
mustache         2.480000   0.030000   2.510000 (  2.515265)
liquid           0.410000   0.010000   0.420000 (  0.414001)
markaby          2.390000   0.010000   2.400000 (  2.401374)
builder          1.900000   0.010000   1.910000 (  1.904287)

############################################################
##        Compilation (big template) - 1.000 runs         ##
############################################################
                     user     system      total        real
string           0.030000   0.010000   0.040000 (  0.043037)
erubis           0.130000   0.020000   0.150000 (  0.156926)
erb              0.320000   0.020000   0.340000 (  0.339588)
haml             1.210000   0.030000   1.240000 (  1.231755)
slim             2.460000   0.030000   2.490000 (  2.491272)
mustache         0.030000   0.010000   0.040000 (  0.047284)
liquid           0.110000   0.020000   0.130000 (  0.124385)
markaby          0.020000   0.020000   0.040000 (  0.037225)
builder          0.020000   0.010000   0.030000 (  0.038738)

############################################################
##      Render (big template, 150KB data) - 30 runs       ##
############################################################
                     user     system      total        real
string           0.150000   0.010000   0.160000 (  0.155014)
erubis           0.130000   0.010000   0.140000 (  0.135254)
erb              0.200000   0.000000   0.200000 (  0.205322)
haml             0.300000   0.010000   0.310000 (  0.310301)
slim             0.420000   0.000000   0.420000 (  0.423397)
mustache         1.140000   0.000000   1.140000 (  1.137800)
liquid           3.210000   0.010000   3.220000 (  3.221065)
markaby          3.550000   0.020000   3.570000 (  3.560586)
builder          5.620000   0.010000   5.630000 (  5.637401)