From b0d47b3112b00cb6c1ae72d6d8a43e583af117ea Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Sat, 17 Nov 2007 08:22:49 -0800 Subject: significantly improved log performance --- benchmark.rb | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'benchmark.rb') diff --git a/benchmark.rb b/benchmark.rb index 85ddd01..7fc0b5d 100644 --- a/benchmark.rb +++ b/benchmark.rb @@ -1,9 +1,9 @@ require 'fileutils' require 'benchmark' require 'rubygems' -#require 'ruby-prof' -#require_gem 'git', '1.0.2' -require 'lib/git' +require 'ruby-prof' +require_gem 'git', '1.0.3' +#require 'lib/git' def main @wbare = File.expand_path(File.join('tests', 'files', 'working.git')) @@ -12,8 +12,9 @@ def main g = Git.clone(@wbare, 'test') g.chdir do - n = 30 - #result = RubyProf.profile do + n = 40 + result = RubyProf.profile do + puts "
"
       
       Benchmark.bm(8) do |x|
         run_code(x, 'objects') do
@@ -94,22 +95,27 @@ def main
                g.write_tree
              end
           end
-        end
+        end rescue nil
 
         x.report('archive ') do
           n.times do
             f = g.gcommit('v2.6').archive # returns path to temp file
           end
         end rescue nil
-        
+   
+	     
       end
     
-      #end
+      end
 
       # Print a graph profile to text
-      #printer = RubyProf::FlatPrinter.new(result)
-      #printer.print(STDOUT, 0)
-      
+      puts "
" + printer = RubyProf::GraphHtmlPrinter.new(result) + printer.print(STDOUT, 1) + printer = RubyProf::FlatPrinter.new(result) + puts "
"
+      printer.print(STDOUT, 1)
+      puts "
" end end end @@ -148,4 +154,4 @@ def in_temp_dir(remove_after = true) FileUtils.rm_r(tmp_path) if remove_after end -main() \ No newline at end of file +main() -- cgit