Created
November 3, 2011 14:17
-
-
Save skanev/1336588 to your computer and use it in GitHub Desktop.
Debugging the performance of a Rails controller action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails/console/app' | |
ActiveSupport::Notifications.subscribe /^sql\./ do |*args| | |
puts caller.grep(%r[/garmz/]) { |line| " #{line.gsub(/.*?\/garmz\//, '')}" }.take(3) * "\n" | |
end | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
app.get '/newsfeed' | |
ActiveRecord::Base.logger = Logger.new(nil) | |
Benchmark.bm do |b| | |
b.report do | |
5.times { app.get '/newsfeed' } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment