diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-02 12:36:36 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-02 12:36:36 -0300 |
commit | fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90 (patch) | |
tree | 89f6b8eeae81ba9e9f3c43667b234b64a776e649 /actionpack/examples/minimal.rb | |
parent | 5255a81b808c2c947d58df979e6436b1fe1d8157 (diff) | |
parent | 196f780e30fcece25e4d09c12f9b9f7374ebed29 (diff) | |
download | rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.gz rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.bz2 rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record.rb
Diffstat (limited to 'actionpack/examples/minimal.rb')
-rw-r--r-- | actionpack/examples/minimal.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/actionpack/examples/minimal.rb b/actionpack/examples/minimal.rb index e2d112648c..9eb92cd8e7 100644 --- a/actionpack/examples/minimal.rb +++ b/actionpack/examples/minimal.rb @@ -24,10 +24,12 @@ class Runner out.puts '---' end - def self.run(app, n) + def self.run(app, n, label = nil) + puts '=' * label.size, label, '=' * label.size if label env = { 'n' => n, 'rack.input' => StringIO.new(''), 'rack.errors' => $stdout } t = Benchmark.realtime { new(app).call(env) } - puts "%d ms / %d req = %d usec/req" % [10**3 * t, n, 10**6 * t / n] + puts "%d ms / %d req = %.1f usec/req" % [10**3 * t, n, 10**6 * t / n] + puts end end @@ -38,16 +40,19 @@ class BasePostController < ActionController::Base def index render :text => '' end - - Runner.run(action(:index), N) end +OK = [200, {}, []] +MetalPostController = lambda { OK } + if ActionController.const_defined?(:Http) class HttpPostController < ActionController::Http def index self.response_body = '' end - - Runner.run(action(:index), N) end end + +Runner.run(MetalPostController, N, 'metal') +Runner.run(HttpPostController.action(:index), N, 'http') if defined? HttpPostController +Runner.run(BasePostController.action(:index), N, 'base') |