aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/examples
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-08-09 03:30:10 -0300
committerYehuda Katz <wycats@gmail.com>2009-08-09 04:12:09 -0300
commite8849203dc68d1a2fabf5e6b51b379ad1c51f8c8 (patch)
tree74dead5190dca5e2a2edf458e77a4c9ea62a59e3 /actionpack/examples
parentb05c95190737eb39047a756e37d811b340a47ba2 (diff)
downloadrails-e8849203dc68d1a2fabf5e6b51b379ad1c51f8c8.tar.gz
rails-e8849203dc68d1a2fabf5e6b51b379ad1c51f8c8.tar.bz2
rails-e8849203dc68d1a2fabf5e6b51b379ad1c51f8c8.zip
Updates to benchmark harness.
Diffstat (limited to 'actionpack/examples')
-rw-r--r--actionpack/examples/minimal.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/actionpack/examples/minimal.rb b/actionpack/examples/minimal.rb
index bf36f518bd..2697d1f391 100644
--- a/actionpack/examples/minimal.rb
+++ b/actionpack/examples/minimal.rb
@@ -6,6 +6,7 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
require 'action_controller'
require 'action_controller/new_base' if ENV['NEW']
+require 'action_view'
require 'benchmark'
class Runner
@@ -37,9 +38,19 @@ end
N = (ENV['N'] || 1000).to_i
+module ActionController::Rails2Compatibility
+ instance_methods.each do |name|
+ remove_method name
+ end
+end
+
class BasePostController < ActionController::Base
append_view_path "#{File.dirname(__FILE__)}/views"
+ def overhead
+ self.response_body = ''
+ end
+
def index
render :text => ''
end
@@ -71,17 +82,27 @@ class HttpPostController < ActionController::Metal
end
unless ENV["PROFILE"]
+ Runner.run(BasePostController.action(:overhead), N, 'overhead')
+ Runner.run(BasePostController.action(:index), N, 'index')
+ Runner.run(BasePostController.action(:partial), N, 'partial')
+ Runner.run(BasePostController.action(:many_partials), N, 'many_partials')
+ Runner.run(BasePostController.action(:partial_collection), N, 'collection')
+ Runner.run(BasePostController.action(:show_template), N, 'template')
+
(ENV["M"] || 1).to_i.times do
+ Runner.run(BasePostController.action(:overhead), N, 'overhead')
+ Runner.run(BasePostController.action(:index), N, 'index')
Runner.run(BasePostController.action(:partial), N, 'partial')
Runner.run(BasePostController.action(:many_partials), N, 'many_partials')
Runner.run(BasePostController.action(:partial_collection), N, 'collection')
Runner.run(BasePostController.action(:show_template), N, 'template')
end
else
+ Runner.run(BasePostController.action(:many_partials), N, 'many_partials')
require "ruby-prof"
RubyProf.start
- Runner.run(BasePostController.action(:many_partials), N, 'partial')
+ Runner.run(BasePostController.action(:many_partials), N, 'many_partials')
result = RubyProf.stop
printer = RubyProf::CallStackPrinter.new(result)
- printer.print(File.open("output.html", "w"), :min_percent => 2)
+ printer.print(File.open("output.html", "w"))
end \ No newline at end of file