benchmark/slim/run-benchmarks.rb in hamlit-2.7.5 vs benchmark/slim/run-benchmarks.rb in hamlit-2.8.0

- old
+ new

@@ -45,12 +45,13 @@ require 'haml' require 'faml' require 'hamlit' class SlimBenchmarks - def initialize(slow) - @benches = [] + def initialize(only_haml) + @only_haml = only_haml + @benches = [] @erb_code = File.read(File.dirname(__FILE__) + '/view.erb') @haml_code = File.read(File.dirname(__FILE__) + '/view.haml') @slim_code = File.read(File.dirname(__FILE__) + '/view.slim') @@ -68,12 +69,12 @@ def run_slim_ugly; #{Slim::Engine.new.call @slim_code}; end def run_faml; #{Faml::Engine.new.call @haml_code}; end def run_hamlit; #{Hamlit::Engine.new.call @haml_code}; end } - bench("erubis v#{Erubis::VERSION}") { context.run_erubis } - bench("slim v#{Slim::VERSION}") { context.run_slim_ugly } + bench("erubis v#{Erubis::VERSION}") { context.run_erubis } unless @only_haml + bench("slim v#{Slim::VERSION}") { context.run_slim_ugly } unless @only_haml bench("haml v#{Haml::VERSION}") { context.run_haml_ugly } bench("faml v#{Faml::VERSION}") { context.run_faml } bench("hamlit v#{Hamlit::VERSION}") { context.run_hamlit } end @@ -89,6 +90,6 @@ def bench(name, &block) @benches.push([name, block]) end end -SlimBenchmarks.new(ENV['slow']).run +SlimBenchmarks.new(ENV['ONLY_HAML'] == '1').run