Sha256: 62802f78796f37b8b68269d348280786f67dadf22e0f195918d2da6942cc9490

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

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|
  x.report('Haml') { Haml::Engine.new(haml_code, ugly: true, escape_html: true) }
  x.report('Faml') { Faml::Engine.new.call(haml_code) }
  if slim_code
    x.report('Slim') { Slim::Engine.new.call(slim_code) }
  end
  x.compare!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faml-0.2.9 benchmark/compiling.rb