Unify benchmark condition

This commit is contained in:
Takashi Kokubun 2015-11-03 01:04:53 +09:00
parent 0bb189b48d
commit c737513d91
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class Bench < Thor
def code(file)
haml = File.read(file)
puts "#{?= * 49}\n Haml Source: #{file}\n#{?= * 49}"
puts Haml::Engine.new(haml).precompiled
puts Haml::Engine.new(haml, escape_html: true, escape_attrs: true, ugly: true).precompiled
puts "\n#{?= * 49}\n Faml Source: #{file}\n#{?= * 49}"
puts Faml::Engine.new.call(haml)
puts "\n#{?= * 49}\n Hamlit Source: #{file}\n#{?= * 49}"
@ -78,7 +78,7 @@ class Bench < Thor
haml = File.read(file)
Benchmark.ips do |x|
x.report("haml v#{Haml::VERSION}") { Haml::Engine.new(haml).precompiled }
x.report("haml v#{Haml::VERSION}") { Haml::Engine.new(haml, escape_html: true, escape_attrs: true, ugly: true).precompiled }
x.report("faml v#{Faml::VERSION}") { Faml::Engine.new.call(haml) }
x.report("hamlit v#{Hamlit::VERSION}") { Hamlit::Engine.new.call(haml) }
x.compare!
@ -93,7 +93,7 @@ class Bench < Thor
object.instance_eval(File.read(ruby_file))
end
Haml::Engine.new(haml).def_method(object, :haml)
Haml::Engine.new(haml, escape_html: true, escape_attrs: true, ugly: true).def_method(object, :haml)
object.instance_eval "def faml; #{Faml::Engine.new.call(haml)}; end"
object.instance_eval "def hamlit; #{Hamlit::Engine.new.call(haml)}; end"