Sha256: 460c0a40000d3cdb7b4cb0244a45587c6338aedc678487235054ab285b94df07

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

#!/usr/bin/env ruby
require 'benchmark/ips'
require 'haml'
require 'faml'
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 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('Slim') { context.slim }
  x.compare!
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faml-0.2.9 benchmark/slim.rb
faml-0.2.8 benchmark/slim.rb
faml-0.2.7 benchmark/slim.rb
faml-0.2.6 benchmark/slim.rb