Sha256: 586b24775996bad445d50b0d7ed243d02c5b91b5ea6b681ee008b58ac38f9da4
Contents?: true
Size: 943 Bytes
Versions: 9
Compression:
Stored size: 943 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' 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
9 entries across 9 versions & 1 rubygems