require 'rubygems' require File.join(File.dirname(__FILE__), 'lib', 'xup') require 'redcloth' require 'haml' require 'markaby' require 'benchmark' Xup.load :xml n = 10_000 Benchmark.bm(10) do |x| x.report("xup:") do for i in 0..n xc = Xup::Context.new xc.instance_eval { use :XML tag! :para, "foo" tag! :ul do tag! :li, 'one' tag! :li, 'two' tag! :li, 'three' end } xc.buffer end end x.report("xup (str):") do for i in 0..n xc = Xup::Context.new xc.instance_eval &lambda { eval <<-eof use :XML tag! :para, "foo" tag! :ul do tag! :li, 'one' tag! :li, 'two' tag! :li, 'three' end eof } xc.buffer end end x.report("markaby:") do for i in 0..n Markaby::Builder.new { p "foo" ul { li "one" li "two" li "three" } }.streams.first.first end end x.report("textile:") do for i in 0..n RedCloth.new("p. foo\n\n* one\n* two\n* three").to_html end end x.report("haml:") do for i in 0..n Haml::Engine.new("%p foo\n%ul\n %li one\n %li two\n %li three").to_html end end end