Skip to content

Instantly share code, notes, and snippets.

@sarogers
Created January 7, 2016 23:50
Show Gist options
  • Save sarogers/ad2e9337516e98c7240a to your computer and use it in GitHub Desktop.
Save sarogers/ad2e9337516e98c7240a to your computer and use it in GitHub Desktop.
[18:44:46] ~/code/oss/slim on master
>> bundle exec rake bench slow=1 iterations=1000
/Users/spencer1248/.rvm/rubies/ruby-2.2.1/bin/ruby benchmarks/run-benchmarks.rb
Calculating -------------------------------------
(1) erb 8.785k i/100ms
(1) erubis 10.457k i/100ms
(1) fast erubis 9.821k i/100ms
(1) temple erb 7.342k i/100ms
(1) slim pretty 3.516k i/100ms
(1) slim ugly 10.595k i/100ms
(1) haml pretty 1.952k i/100ms
(1) haml ugly 2.130k i/100ms
(2) erb 5.078k i/100ms
(2) erubis 7.753k i/100ms
(2) temple erb 5.794k i/100ms
(2) slim pretty 2.987k i/100ms
(2) slim ugly 7.673k i/100ms
(2) haml pretty 1.807k i/100ms
(2) haml ugly 2.025k i/100ms
(3) erb 448.000 i/100ms
(3) erubis 521.000 i/100ms
(3) fast erubis 518.000 i/100ms
(3) temple erb 137.000 i/100ms
(3) slim pretty 29.000 i/100ms
(3) slim ugly 31.000 i/100ms
(3) haml pretty 82.000 i/100ms
(3) haml ugly 86.000 i/100ms
-------------------------------------------------
(1) erb 93.372k (± 3.8%) i/s - 474.390k
(1) erubis 112.003k (± 4.0%) i/s - 564.678k
(1) fast erubis 108.210k (± 4.0%) i/s - 549.976k
(1) temple erb 78.952k (± 3.3%) i/s - 396.468k
(1) slim pretty 36.530k (± 3.4%) i/s - 182.832k
(1) slim ugly 114.091k (± 3.6%) i/s - 572.130k
(1) haml pretty 20.376k (± 2.7%) i/s - 103.456k
(1) haml ugly 22.478k (± 3.4%) i/s - 112.890k
(2) erb 53.920k (± 3.1%) i/s - 274.212k
(2) erubis 66.857k (±22.5%) i/s - 310.120k
(2) temple erb 47.252k (±11.9%) i/s - 237.554k
(2) slim pretty 26.432k (±15.1%) i/s - 128.441k
(2) slim ugly 76.710k (± 8.7%) i/s - 391.323k
(2) haml pretty 15.356k (±22.8%) i/s - 72.280k
(2) haml ugly 18.389k (±15.0%) i/s - 91.125k
(3) erb 4.319k (± 4.8%) i/s - 21.952k
(3) erubis 4.728k (±10.4%) i/s - 23.445k
(3) fast erubis 4.809k (±10.6%) i/s - 23.828k
(3) temple erb 1.149k (±19.5%) i/s - 5.480k
(3) slim pretty 234.266 (±16.6%) i/s - 1.160k
(3) slim ugly 197.959 (±18.7%) i/s - 992.000
(3) haml pretty 620.067 (±20.8%) i/s - 2.952k
(3) haml ugly 732.314 (±15.7%) i/s - 3.612k
(1) Compiled benchmark. Template is parsed before the benchmark and
generated ruby code is compiled into a method.
This is the fastest evaluation strategy because it benchmarks
pure execution speed of the generated ruby code.
(2) Compiled Tilt benchmark. Template is compiled with Tilt, which gives a more
accurate result of the performance in production mode in frameworks like
Sinatra, Ramaze and Camping. (Rails still uses its own template
compilation.)
(3) Parsing benchmark. Template is parsed every time.
This is not the recommended way to use the template engine
and Slim is not optimized for it. Activate this benchmark with 'rake bench slow=1'.
Temple ERB is the ERB implementation using the Temple framework. It shows the
overhead added by the Temple framework compared to ERB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment