bin/bench in hamlit-2.1.0 vs bin/bench in hamlit-2.1.1
- old
+ new
@@ -3,11 +3,10 @@
require 'bundler/setup'
require 'hamlit'
require 'faml'
require 'thor'
require 'benchmark/ips'
-require 'hamlit1' if File.exist?('hamlit1')
require_relative '../benchmark/utils/benchmark_ips_extension'
class Bench < Thor
class_option :show_template, type: :boolean, aliases: ['-t']
@@ -26,12 +25,11 @@
haml = File.read(file)
Benchmark.ips do |x|
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#{File.exist?('hamlit1') ? '2' : ''} v#{Hamlit::VERSION}") { Hamlit::Engine.new.call(haml) }
- x.report("hamlit1 v#{Hamlit1::VERSION}") { Hamlit1::Engine.new.call(haml) } if File.exist?('hamlit1')
+ x.report("hamlit v#{Hamlit::VERSION}") { Hamlit::Engine.new.call(haml) }
x.compare!
end
end
desc 'render HAML', 'Benchmark rendering'
@@ -46,17 +44,15 @@
end
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"
- object.instance_eval "def hamlit1; #{Hamlit1::Engine.new.call(haml)}; end" if File.exist?('hamlit1')
Benchmark.ips do |x|
x.report("haml v#{Haml::VERSION}") { object.haml }
x.report("faml v#{Faml::VERSION}") { object.faml }
- x.report("hamlit#{File.exist?('hamlit1') ? '2' : ''} v#{Hamlit::VERSION}") { object.hamlit }
- x.report("hamlit1 v#{Hamlit1::VERSION}") { object.hamlit1 } if File.exist?('hamlit1')
+ x.report("hamlit v#{Hamlit::VERSION}") { object.hamlit }
x.compare!
end
end
desc 'code HAML', 'Show compiled code'
@@ -66,13 +62,9 @@
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}"
puts Hamlit::Engine.new.call(haml)
- if File.exist?('hamlit1')
- puts "\n#{?= * 49}\n Hamlit1 Source: #{file}\n#{?= * 49}"
- puts Hamlit1::Engine.new.call(haml)
- end
end
private
def method_missing(*args)