Show code on benchmark

This commit is contained in:
Takashi Kokubun 2015-11-22 20:34:52 +09:00
parent eb68642b92
commit 22a1d8b3f5
2 changed files with 8 additions and 6 deletions

View File

@ -9,6 +9,7 @@ require 'hamlit1' if File.exist?('hamlit1')
class Bench < Thor
class_option :with_hamlit1, type: :boolean, aliases: ['-w']
class_option :show_template, type: :boolean, aliases: ['-t']
desc 'bench HAML', 'Benchmark haml template'
option :compile, type: :boolean, aliases: ['-c']
@ -37,6 +38,7 @@ class Bench < Thor
def render(file)
puts "#{?= * 49}\n Rendering: #{file}\n#{?= * 49}"
haml = File.read(file)
puts haml + "\n" if options[:show_template]
object = Object.new
ruby_file = file.gsub(/\.haml\z/, '.rb')
if File.exist?(ruby_file)

View File

@ -14,22 +14,22 @@ build:
code: bin/clone
- script:
name: "[benchmark] static attributes"
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
code: bin/bench bench -w -t 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 -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
code: bin/bench bench -w -t 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 -w benchmark/plain.haml
code: bin/bench bench -w -t benchmark/plain.haml
- script:
name: "[benchmark] script"
code: bin/bench bench -w benchmark/script.haml
code: bin/bench bench -w -t benchmark/script.haml
- script:
name: "[benchmark] attribute_builder bench by faml"
code: bin/bench bench -w benchmark/etc/attribute_builder.haml
code: bin/bench bench -w -t benchmark/etc/attribute_builder.haml
- script:
name: "[benchmark] slim-template/slim/benchmarks"
code: bundle exec ruby benchmark/slim/run-benchmarks.rb
- script:
name: "[benchmark] static analyzer"
code: bin/bench bench -w benchmark/etc/static_analyzer.haml
code: bin/bench bench -w -t benchmark/etc/static_analyzer.haml