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:
parent
bbd54a926d
commit
65897ef8f0
|
@ -43,11 +43,15 @@ module Haml
|
||||||
old_stdout = $stdout
|
old_stdout = $stdout
|
||||||
$stdout = StringIO.new
|
$stdout = StringIO.new
|
||||||
|
|
||||||
Benchmark.bmbm do |b|
|
times = Benchmark.bmbm do |b|
|
||||||
b.report("haml:") { runs.times { @base.render haml_template } }
|
b.report("haml:") { runs.times { @base.render haml_template } }
|
||||||
b.report("erb:") { runs.times { @base.render rhtml_template } }
|
b.report("erb:") { runs.times { @base.render rhtml_template } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#puts times.inspect
|
||||||
|
ratio = sprintf("%g", times[0].to_a[5] / times[1].to_a[5])
|
||||||
|
puts "Haml/ERB: " + ratio
|
||||||
|
|
||||||
$stdout.pos = 0
|
$stdout.pos = 0
|
||||||
to_return = $stdout.read
|
to_return = $stdout.read
|
||||||
$stdout = old_stdout
|
$stdout = old_stdout
|
||||||
|
|
Loading…
Reference in New Issue