parent
4d725c69eb
commit
ae88389a43
|
@ -1,17 +0,0 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
title Simple Benchmark
|
||||
body
|
||||
h1 = header
|
||||
- unless item.empty?
|
||||
ul
|
||||
- for i in item
|
||||
- if i[:current]
|
||||
li
|
||||
strong = i[:name]
|
||||
- else
|
||||
li
|
||||
a href=i[:url] = i[:name]
|
||||
- else
|
||||
p The list is empty.
|
|
@ -3,7 +3,6 @@
|
|||
require 'bundler/setup'
|
||||
require 'hamlit'
|
||||
require 'faml'
|
||||
require 'slim'
|
||||
require 'thor'
|
||||
require 'benchmark/ips'
|
||||
require 'hamlit1' if File.exist?('hamlit1')
|
||||
|
@ -40,21 +39,20 @@ class Bench < Thor
|
|||
haml = File.read(file)
|
||||
object = Object.new
|
||||
ruby_file = file.gsub(/\.haml\z/, '.rb')
|
||||
object.instance_eval(File.read(ruby_file)) if File.exist?(ruby_file)
|
||||
slim_file = file.gsub(/\.haml\z/, '.slim')
|
||||
if File.exist?(ruby_file)
|
||||
object.instance_eval(File.read(ruby_file))
|
||||
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')
|
||||
object.instance_eval "def slim; #{Slim::Engine.new.call(File.read(slim_file))}; end" if File.exist?(slim_file)
|
||||
|
||||
Benchmark.ips do |x|
|
||||
x.report("haml v#{Haml::VERSION}") { object.haml }
|
||||
x.report("faml v#{Faml::VERSION}") { object.faml }
|
||||
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.report("slim v#{Hamlit1::VERSION}") { object.slim } if File.exist?(slim_file)
|
||||
x.compare!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
|
|||
spec.add_development_dependency 'rake', '~> 10.0'
|
||||
spec.add_development_dependency 'redcarpet'
|
||||
spec.add_development_dependency 'sass'
|
||||
spec.add_development_dependency 'slim'
|
||||
spec.add_development_dependency 'therubyracer'
|
||||
spec.add_development_dependency 'thor', '~> 0.19'
|
||||
spec.add_development_dependency 'unindent'
|
||||
|
|
Loading…
Reference in New Issue