Sha256: 62ff949374aaf048a66fa57b472d9a71b915616d662a171d282e52f61669d3c5

Contents?: true

Size: 913 Bytes

Versions: 10

Compression:

Stored size: 913 Bytes

Contents

#!/usr/bin/env ruby
require 'benchmark/ips'
require 'haml'
require 'faml'
require 'hamlit'
require 'slim'
require 'escape_utils/html/haml'

require_relative 'context'

haml_code = File.read(File.join(__dir__, 'view.haml'))
slim_code = File.read(File.join(__dir__, 'view.slim'))

context = Context.new
Haml::Engine.new(haml_code, ugly: true, escape_html: true).def_method(context, :haml)
context.instance_eval "
  def faml; #{Faml::Engine.new(generator: Temple::Generators::RailsOutputBuffer).call(haml_code)}; end
  def hamlit; #{Hamlit::Engine.new(generator: Temple::Generators::RailsOutputBuffer).call(haml_code)}; end
  def slim; #{Slim::Engine.new(generator: Temple::Generators::RailsOutputBuffer).call(slim_code)}; end
"

Benchmark.ips do |x|
  x.report('Haml') { context.haml }
  x.report('Faml') { context.faml }
  x.report('Hamlit') { context.hamlit }
  x.report('Slim') { context.slim }
  x.compare!
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
faml-0.6.0 benchmark/slim.rb
faml-0.5.1 benchmark/slim.rb
faml-0.5.0 benchmark/slim.rb
faml-0.4.2 benchmark/slim.rb
faml-0.4.1 benchmark/slim.rb
faml-0.4.0 benchmark/slim.rb
faml-0.3.6 benchmark/slim.rb
faml-0.3.5 benchmark/slim.rb
faml-0.3.4 benchmark/slim.rb
faml-0.3.3 benchmark/slim.rb