Percentage of samples already printed before this line Number of samples in this method and methods it calls Percentage of samples in this method and methods it calls Friday, February 3, 12
methods that are computationally expensive ▪ PDF can show you both: ▪ Big Boxes (computationally expensive) ▪ Call Paths (delegation complexity) 40 Friday, February 3, 12
with comments and tags ▪ Access the dashboard ▪ 5 most recent articles ▪ 5 most recent comments ▪ Request-time computed statistics about the site 41 Rendered dashboard/show.html.erb within layouts/application (473.9ms) Completed 200 OK in 2371ms (Views: 436.2ms | ActiveRecord: 926.3ms) Friday, February 3, 12
(473.9ms) Completed 200 OK in 2371ms (Views: 436.2ms | ActiveRecord: 926.3ms) Rendered dashboard/show.html.erb within layouts/application (425.8ms) Completed 200 OK in 696ms (Views: 343.5ms | ActiveRecord: 117.6ms) 70% Performance Improvement ▪ Stub out .most_popular and re-run Friday, February 3, 12
SQLite3::Statement#step 24 13.6% 75.7% 24 13.6% NilClass#raise_nil_warning_f 11 6.2% 81.9% 11 6.2% garbage_collector All the time is spent in the DB Friday, February 3, 12
within layouts/application (409.4ms) Completed 200 OK in 418ms (Views: 349.9ms | ActiveRecord: 67.5ms) Rendered articles/index.html.erb within layouts/application (377.0ms) Completed 200 OK in 387ms (Views: 337.2ms | ActiveRecord: 49.7ms) 10% Performance Improvement ▪ Switched to .count Friday, February 3, 12
ORDER BY created_at DESC LIMIT 5 SLOW QUERY Comment Load (8.0ms) SELECT "comments".* FROM "comments" ORDER BY created_at DESC LIMIT 5 app/models/comment.rb:7 | app/controllers/dashboard_controller.rb:8 Reveals need for an index Friday, February 3, 12
▪ Profile Memory with Memprof (1.8.7) or Perftools.rb ▪ Watch your Database ▪ N+1 Queries with Bullet ▪ Slow Queries with Slowjam / Auto-EXPLAIN ▪ Links and more resources at: http://jumpstartlab.com/performance Jeff Casimir / @j3 Metrics-Driven Rails Performance Friday, February 3, 12