mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Hamlit1 benchmarking is unnecessary for slim_bench
This commit is contained in:
parent
e1c4952e1e
commit
5518dd1043
2 changed files with 14 additions and 10 deletions
14
bin/bench
14
bin/bench
|
@ -8,10 +8,14 @@ require 'benchmark/ips'
|
|||
require 'hamlit1' if File.exist?('hamlit1')
|
||||
|
||||
class Bench < Thor
|
||||
class_option :with_hamlit1, type: :boolean, aliases: ['-w']
|
||||
|
||||
desc 'bench HAML', 'Benchmark haml template'
|
||||
option :show_code, type: :boolean, aliases: ['-c']
|
||||
option :compile, type: :boolean, aliases: ['-c']
|
||||
option :show_code, type: :boolean, aliases: ['-s']
|
||||
def bench(*files)
|
||||
files.each { |file| render(file) }
|
||||
files.each { |file| compile(file) if options[:compile] }
|
||||
files.each { |file| code(file) if options[:show_code] }
|
||||
end
|
||||
|
||||
|
@ -23,8 +27,8 @@ class Bench < Thor
|
|||
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("hamlit2 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#{options[:with_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') && options[:with_hamlit1]
|
||||
x.compare!
|
||||
end
|
||||
end
|
||||
|
@ -47,8 +51,8 @@ class Bench < Thor
|
|||
Benchmark.ips do |x|
|
||||
x.report("haml v#{Haml::VERSION}") { object.haml }
|
||||
x.report("faml v#{Faml::VERSION}") { object.faml }
|
||||
x.report("hamlit2 v#{Hamlit::VERSION}") { object.hamlit }
|
||||
x.report("hamlit1 v#{Hamlit1::VERSION}") { object.hamlit1 } if File.exist?('hamlit1')
|
||||
x.report("hamlit#{options[:with_hamlit1] ? '2' : ''} v#{Hamlit::VERSION}") { object.hamlit }
|
||||
x.report("hamlit1 v#{Hamlit1::VERSION}") { object.hamlit1 } if File.exist?('hamlit1') && options[:with_hamlit1]
|
||||
x.compare!
|
||||
end
|
||||
end
|
||||
|
|
10
wercker.yml
10
wercker.yml
|
@ -14,19 +14,19 @@ build:
|
|||
code: bin/clone
|
||||
- script:
|
||||
name: "[benchmark] static attributes"
|
||||
code: bin/bench bench benchmark/boolean_attribute.haml benchmark/class_attribute.haml benchmark/id_attribute.haml benchmark/data_attribute.haml benchmark/common_attribute.haml
|
||||
code: bin/bench bench -w benchmark/boolean_attribute.haml benchmark/class_attribute.haml benchmark/id_attribute.haml benchmark/data_attribute.haml benchmark/common_attribute.haml
|
||||
- script:
|
||||
name: "[benchmark] dynamic attributes"
|
||||
code: bin/bench bench benchmark/dynamic_attributes/boolean_attribute.haml benchmark/dynamic_attributes/class_attribute.haml benchmark/dynamic_attributes/id_attribute.haml benchmark/dynamic_attributes/data_attribute.haml benchmark/dynamic_attributes/common_attribute.haml
|
||||
code: bin/bench bench -w benchmark/dynamic_attributes/boolean_attribute.haml benchmark/dynamic_attributes/class_attribute.haml benchmark/dynamic_attributes/id_attribute.haml benchmark/dynamic_attributes/data_attribute.haml benchmark/dynamic_attributes/common_attribute.haml
|
||||
- script:
|
||||
name: "[benchmark] plain text"
|
||||
code: bin/bench bench benchmark/plain.haml
|
||||
code: bin/bench bench -w benchmark/plain.haml
|
||||
- script:
|
||||
name: "[benchmark] script"
|
||||
code: bin/bench bench benchmark/script.haml
|
||||
code: bin/bench bench -w benchmark/script.haml
|
||||
- script:
|
||||
name: "[benchmark] attribute_builder bench by faml"
|
||||
code: bin/bench bench benchmark/etc/attribute_builder.haml
|
||||
code: bin/bench bench -w benchmark/etc/attribute_builder.haml
|
||||
- script:
|
||||
name: "[benchmark] basic bench by slim"
|
||||
code: bin/bench bench benchmark/etc/slim_bench.haml
|
||||
|
|
Loading…
Add table
Reference in a new issue