Sha256: 5633b179dd17e66652bf21767c55de8d4d224aaaa00dceefca3c25a6c9f12351
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
#!/usr/bin/env ruby require 'benchmark/ips' require 'haml' require 'faml' require 'slim' require 'escape_utils/html/haml' unless ARGV[0] $stderr.puts "Usage: #{$0} template.haml [template.slim]" exit 1 end haml_code = File.read(ARGV[0]) slim_code = ARGV[1] ? File.read(ARGV[1]) : nil Benchmark.ips do |x| obj = Object.new Haml::Engine.new(haml_code, ugly: true, escape_html: true).def_method(obj, :haml) obj.instance_eval %{ def faml_array; #{Faml::Engine.new.call(haml_code)}; end def faml_string; #{Faml::Engine.new(generator: Temple::Generators::RailsOutputBuffer).call(haml_code)}; end } if slim_code obj.instance_eval %{ def slim_array; #{Slim::Engine.new.call(slim_code)}; end def slim_string; #{Slim::Engine.new(generator: Temple::Generators::RailsOutputBuffer).call(slim_code)}; end } end x.report('Haml') { obj.haml } x.report('Faml (Array)') { obj.faml_array } x.report('Faml (String)') { obj.faml_string } if slim_code x.report('Slim (Array)') { obj.slim_array } x.report('Slim (String)') { obj.slim_string } end x.compare! end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
faml-0.2.9 | benchmark/rendering.rb |
faml-0.2.8 | benchmark/rendering.rb |
faml-0.2.7 | benchmark/rendering.rb |
faml-0.2.6 | benchmark/rendering.rb |