$:.unshift 'lib' require 'benchmark/ips' require 'mustache' template = """
""" data_without_escaping = { :external_index=>"product", :url=>"/products/7", :image=>"products/product.jpg" } data_with_escaping = { :external_index=>"

Bear > Shark

", :url=>"/

Bear > Shark

/7", :image=>"products/

Bear > Shark

.jpg" } template = Mustache::Template.new(template) Benchmark.ips do |x| x.report("render template without escaping") do |times| ctx = Mustache::Context.new(Mustache.new); ctx.push(data_without_escaping) template.render(ctx) end x.report("render template with escaping") do |times| ctx = Mustache::Context.new(Mustache.new); ctx.push(data_with_escaping) template.render(ctx) end end