Sha256: 3102e39354e739e2ff738b335ae2f48d59f79eaa25e3a5de60a708ce11f7829b

Contents?: true

Size: 664 Bytes

Versions: 9

Compression:

Stored size: 664 Bytes

Contents

#!/usr/bin/env ruby
# frozen-string-literal: true
require 'benchmark/ips'
require 'haml'
require 'faml'
require 'hamlit'
require 'slim'
require 'escape_utils/html/haml'

unless ARGV[0]
  $stderr.puts "Usage: #{$PROGRAM_NAME} 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) }
  x.report('Hamlit') { Hamlit::Engine.new.call(haml_code) }
  if slim_code
    x.report('Slim') { Slim::Engine.new.call(slim_code) }
  end
  x.compare!
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
faml-0.7.3 benchmark/compiling.rb
faml-0.7.2 benchmark/compiling.rb
faml-0.7.1 benchmark/compiling.rb
faml-0.7.0 benchmark/compiling.rb
faml-0.6.5 benchmark/compiling.rb
faml-0.6.4 benchmark/compiling.rb
faml-0.6.3 benchmark/compiling.rb
faml-0.6.2 benchmark/compiling.rb
faml-0.6.1 benchmark/compiling.rb