1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Now I don't care about benchmark against v1

This commit is contained in:
Takashi Kokubun 2015-12-14 07:48:23 +09:00
parent 9a5f15a940
commit 23f6c291d8
4 changed files with 2 additions and 26 deletions

1
.gitignore vendored
View file

@ -8,7 +8,6 @@
/spec/reports/
/tmp/
.sass-cache
/hamlit1
.ruby-version
*.bundle
*.so

View file

@ -82,7 +82,6 @@ task bench: :compile do
else
cmd = ['bin/bench', 'bench', ('-c' if ENV['COMPILE'] == '1'), *ENV['TEMPLATE'].split(',')].compact
end
system('bin/clone')
exit system(*cmd)
end

View file

@ -5,7 +5,6 @@ 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
@ -28,8 +27,7 @@ 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("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
@ -48,13 +46,11 @@ class Bench < Thor
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
@ -68,10 +64,6 @@ class Bench < Thor
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

View file

@ -1,14 +0,0 @@
#!/bin/bash
if [ -e hamlit1 ]; then
echo 'With hamlit1'
exit 0
fi
git clone --depth=1 -b v1.7.2 https://github.com/k0kubun/hamlit hamlit1
cd hamlit1
git grep --name-only Hamlit | xargs sed -i "" -e "s/Hamlit/Hamlit1/g" 2> /dev/null
git grep --name-only hamlit | xargs sed -i "" -e "s/hamlit/hamlit1/g" 2> /dev/null
git mv hamlit.gemspec hamlit1.gemspec
git mv lib/hamlit.rb lib/hamlit1.rb
git mv lib/hamlit lib/hamlit1