Added a ratio output to benchmark.rb.

git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@142 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2006-11-16 04:34:00 +00:00
parent bbd54a926d
commit 65897ef8f0
1 changed files with 5 additions and 1 deletions

View File

@ -43,11 +43,15 @@ module Haml
old_stdout = $stdout
$stdout = StringIO.new
Benchmark.bmbm do |b|
times = Benchmark.bmbm do |b|
b.report("haml:") { runs.times { @base.render haml_template } }
b.report("erb:") { runs.times { @base.render rhtml_template } }
end
#puts times.inspect
ratio = sprintf("%g", times[0].to_a[5] / times[1].to_a[5])
puts "Haml/ERB: " + ratio
$stdout.pos = 0
to_return = $stdout.read
$stdout = old_stdout