mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Be more fair when caching ERB.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@664 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
6565248d69
commit
7397b41603
1 changed files with 3 additions and 2 deletions
|
@ -48,12 +48,13 @@ module Haml
|
|||
|
||||
obj = Object.new
|
||||
Haml::Engine.new(haml_template).def_method(obj, :haml)
|
||||
erb = ERB.new(erb_template, nil, '-')
|
||||
erb = ERB.new(erb_template, nil, '-')
|
||||
obj.instance_eval("def erb; #{erb.src}; end")
|
||||
Erubis::Eruby.new(erb_template).def_method(obj, :erubis)
|
||||
mab = Markaby::Template.new(markaby_template)
|
||||
times = Benchmark.bmbm do |b|
|
||||
b.report("haml:") { runs.times { obj.haml } }
|
||||
b.report("erb:") { runs.times { erb.render } }
|
||||
b.report("erb:") { runs.times { obj.erb } }
|
||||
b.report("erubis:") { runs.times { obj.erubis } }
|
||||
b.report("mab:") { runs.times { mab.render } }
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue