<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,5 @@
 pkg
 doc
+tmp/*
 *.sqlite3
 database.yml</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -20,6 +20,9 @@ include Benchmark
 # Don't include compilation in the benchmark
 ARGV.each { |expression| eval(expression) }
 
+# Ensure we're running on a clean database
+[Product, Category].each(&amp;:delete_all)
+
 bm(6) do |x|
   ARGV.each_with_index do |expression, idx|
     x.report(&quot;##{idx + 1}&quot;) { N.times { eval(expression) } }</diff>
      <filename>script/benchmarker</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 if ARGV.empty?
-  $stderr.puts &quot;Usage: ./script/profiler 'Person.expensive_method(10)' [times] [flat|graph|graph_html]&quot;
+  $stderr.puts &quot;Usage: ./script/profiler [times] 'Person.expensive_method(10)'&quot;
   exit(1)
 end
 
@@ -8,44 +8,23 @@ end
 # it's just a convenient, quick way to load all the requirements.
 require File.dirname(__FILE__) + '/../spec/spec_helper'
 
+repeat = ARGV.first.to_i &gt; 1 ? ARGV.shift.to_i : 1
+snippet = ARGV.shift
+
 # Define a method to profile.
-if ARGV[1] and ARGV[1].to_i &gt; 1
-  eval &quot;def profile_me() #{ARGV[1]}.times { #{ARGV[0]} } end&quot;
-else
-  eval &quot;def profile_me() #{ARGV[0]} end&quot;
-end
+eval &quot;def profile_me() #{repeat}.times { #{snippet} } end&quot;
+
+# Ensure we're running on a clean database
+[Product, Category].each(&amp;:delete_all)
+
+require &quot;ruby-prof&quot;
+RubyProf.measure_mode = RubyProf::WALL_TIME
+RubyProf.start
+profile_me
+printer = RubyProf::GraphHtmlPrinter.new(RubyProf.stop)
 
-# Use the ruby-prof extension if available.  Fall back to stdlib profiler.
-begin
-  begin
-    require &quot;ruby-prof&quot;
-    $stderr.puts 'Using the ruby-prof extension.'
-    RubyProf.measure_mode = RubyProf::WALL_TIME
-    RubyProf.start
-    profile_me
-    results = RubyProf.stop
-    if ARGV[2]
-      printer_class = RubyProf.const_get((ARGV[2] + &quot;_printer&quot;).classify)
-    else
-      printer_class = RubyProf::FlatPrinter
-    end
-    printer = printer_class.new(results)
-    printer.print($stdout)
-  rescue LoadError
-    require &quot;prof&quot;
-    $stderr.puts 'Using the old ruby-prof extension.'
-    Prof.clock_mode = Prof::GETTIMEOFDAY
-    Prof.start
-    profile_me
-    results = Prof.stop
-    require 'rubyprof_ext'
-    Prof.print_profile(results, $stdout)
-  end
-rescue LoadError
-  require 'profiler'
-  $stderr.puts 'Using the standard Ruby profiler.'
-  Profiler__.start_profile
-  profile_me
-  Profiler__.stop_profile
-  Profiler__.print_profile($stdout)
+Dir.mkdir('tmp') unless File.exist? 'tmp'
+File.open('tmp/profile.html', 'w') do |file|
+  printer.print(file)
 end
+`open tmp/profile.html &amp;`</diff>
      <filename>script/profiler</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ require 'active_record'
 require File.dirname(__FILE__) + '/../lib/populator.rb'
 
 adapter = ENV['POPULATOR_ADAPTER'] || 'sqlite3'
-puts &quot;Running specs on #{adapter}&quot;
+puts &quot;Running on #{adapter}&quot;
 
 # setup database adapter
 ActiveRecord::Base.establish_connection(</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1c1012301e73fa8e26c9b8c88d43ad6f2d3b6dd7</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Bates</name>
    <email>ryan@railscasts.com</email>
  </author>
  <url>http://github.com/ryanb/populator/commit/e8423ee02fbcbbea4988eead4926c710680ed19e</url>
  <id>e8423ee02fbcbbea4988eead4926c710680ed19e</id>
  <committed-date>2008-09-01T11:46:07-07:00</committed-date>
  <authored-date>2008-09-01T11:46:07-07:00</authored-date>
  <message>improving profiler to automatically open results in browser</message>
  <tree>3c3fd2b3f9e90d5be08ae5f2c33e07967cd2ec7d</tree>
  <committer>
    <name>Ryan Bates</name>
    <email>ryan@railscasts.com</email>
  </committer>
</commit>
