From 65897ef8f0bad6f3a8684c49e2e61cafc6a47c28 Mon Sep 17 00:00:00 2001 From: nex3 Date: Thu, 16 Nov 2006 04:34:00 +0000 Subject: [PATCH] Added a ratio output to benchmark.rb. git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@142 7063305b-7217-0410-af8c-cdc13e5119b9 --- test/benchmark.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/benchmark.rb b/test/benchmark.rb index cce35e83..b915357f 100644 --- a/test/benchmark.rb +++ b/test/benchmark.rb @@ -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