Skip to content

Instantly share code, notes, and snippets.

@nirvdrum
Created January 9, 2014 19:58
Show Gist options
  • Select an option

  • Save nirvdrum/8340873 to your computer and use it in GitHub Desktop.

Select an option

Save nirvdrum/8340873 to your computer and use it in GitHub Desktop.
require 'benchmark'
CYCLES = 1_000_000
app = lambda do |env|
[
200,
{ 'Content-Type' => 'text/html' },
['Hello World']
]
end
Benchmark.bmbm do |x|
x.report('base') { CYCLES.times { app.call({}) } }
x.report('ActionDispatch::RequestId') { r = ActionDispatch::RequestId.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::Callbacks') { r = ActionDispatch::Callbacks.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::DebugExceptions') { r = ActionDispatch::DebugExceptions.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::ShowExceptions') { r = ActionDispatch::ShowExceptions.new(app, app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::DebugExceptions') { r = ActionDispatch::DebugExceptions.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::Session::CookieStore') { r = ActionDispatch::Session::CookieStore.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::Head') { r = ActionDispatch::Head.new(app); CYCLES.times { r.call({}) } }
x.report('ActionDispatch::BestStandardsSupport') { r = ActionDispatch::BestStandardsSupport.new(app); CYCLES.times { r.call({}) } }
x.report('Rack::ConditionalGet') { r = Rack::ConditionalGet.new(app); CYCLES.times { r.call({}) } }
x.report('Rack::ETag') { r = Rack::ETag.new(app); CYCLES.times { r.call({}) } }
x.report('Rack::Runtime') { r = Rack::Runtime.new(app); CYCLES.times { r.call({}) } }
x.report('Log4rExceptionable::RackFailureHandler') { r = Log4rExceptionable::RackFailureHandler.new(app); CYCLES.times { r.call({}) } }
x.report('Honeybadger::UserInformer') { r = Honeybadger::UserInformer.new(app); CYCLES.times { r.call({}) } }
x.report('Honeybadger::UserFeedback') { r = Honeybadger::UserFeedback.new(app); CYCLES.times { r.call({}) } }
x.report('Honeybadger::Rack') { r = Honeybadger::Rack.new(app); CYCLES.times { r.call({}) } }
end
Rehearsal --------------------------------------------------------------------------
base 1.380000 0.040000 1.420000 ( 1.220000)
ActionDispatch::RequestId 23.580000 1.840000 25.420000 ( 25.243000)
ActionDispatch::Callbacks 15.950000 0.030000 15.980000 ( 15.908000)
ActionDispatch::DebugExceptions 2.620000 0.000000 2.620000 ( 2.578000)
ActionDispatch::ShowExceptions 1.360000 0.010000 1.370000 ( 1.347000)
ActionDispatch::DebugExceptions 2.580000 0.000000 2.580000 ( 2.571000)
ActionDispatch::Session::CookieStore 10.520000 0.000000 10.520000 ( 10.441000)
ActionDispatch::Head 1.650000 0.010000 1.660000 ( 1.608000)
ActionDispatch::BestStandardsSupport 1.990000 0.010000 2.000000 ( 1.972000)
Rack::ConditionalGet 1.820000 0.020000 1.840000 ( 1.828000)
Rack::ETag 14.730000 0.000000 14.730000 ( 14.640000)
Rack::Runtime 12.060000 0.000000 12.060000 ( 11.977000)
Log4rExceptionable::RackFailureHandler 3.980000 0.010000 3.990000 ( 3.946000)
Honeybadger::UserInformer 2.080000 0.000000 2.080000 ( 2.027000)
Honeybadger::UserFeedback 3.050000 0.000000 3.050000 ( 3.000000)
Honeybadger::Rack 3.490000 0.000000 3.490000 ( 3.451000)
--------------------------------------------------------------- total: 104.810000sec
user system total real
base 1.220000 0.000000 1.220000 ( 1.177000)
ActionDispatch::RequestId 23.380000 2.110000 25.490000 ( 25.412000)
ActionDispatch::Callbacks 16.140000 0.010000 16.150000 ( 15.897000)
ActionDispatch::DebugExceptions 2.630000 0.000000 2.630000 ( 2.605000)
ActionDispatch::ShowExceptions 1.390000 0.010000 1.400000 ( 1.357000)
ActionDispatch::DebugExceptions 2.580000 0.000000 2.580000 ( 2.562000)
ActionDispatch::Session::CookieStore 10.440000 0.000000 10.440000 ( 10.423000)
ActionDispatch::Head 1.600000 0.000000 1.600000 ( 1.567000)
ActionDispatch::BestStandardsSupport 1.980000 0.000000 1.980000 ( 1.961000)
Rack::ConditionalGet 1.880000 0.000000 1.880000 ( 1.833000)
Rack::ETag 14.640000 0.020000 14.660000 ( 14.595000)
Rack::Runtime 12.070000 0.020000 12.090000 ( 11.999000)
Log4rExceptionable::RackFailureHandler 3.930000 0.010000 3.940000 ( 3.891000)
Honeybadger::UserInformer 2.070000 0.010000 2.080000 ( 2.003000)
Honeybadger::UserFeedback 2.970000 0.000000 2.970000 ( 2.957000)
Honeybadger::Rack 3.360000 0.000000 3.360000 ( 3.347000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment