Skip to content

Instantly share code, notes, and snippets.

@solnic
Created November 10, 2015 17:31
Show Gist options
  • Save solnic/c4114d1abdcf0115a789 to your computer and use it in GitHub Desktop.
Save solnic/c4114d1abdcf0115a789 to your computer and use it in GitHub Desktop.
Rodakase template rendering vs link_to helper from ActionView
class ActionRender
include ActionView::Helpers
def button
link_to('User', '/users/1')
end
end
action_renderer = ActionRender.new
rodakase_renderer = Rodakase::View::Renderer.new(Pathname(__FILE__).dirname.join('templates'), engine: :erb)
template = rodakase_renderer.dir.join('button.erb')
SCOPE = {}
Benchmark.ips do |x|
x.report('actionview') { action_renderer.button }
x.report('rodakase') { rodakase_renderer.render(template, SCOPE) }
x.compare!
end
Calculating -------------------------------------
actionview 12.674k i/100ms
rodakase 22.207k i/100ms
-------------------------------------------------
actionview 135.565k (± 7.2%) i/s - 684.396k
rodakase 272.109k (± 6.6%) i/s - 1.355M
Comparison:
rodakase: 272109.1 i/s
actionview: 135564.7 i/s - 2.01x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment