BibApp/BibApp — Issue #74: include method in people_controller is slow
Author: jstirnaman
Created: 2012-01-17 20:43:11+00:00
State: open

At https://github.com/BibApp/BibApp/blob/master/app/controllers/people_controller.rb#L66 eager loading with
includes(:contributorships => :work)
seems to make views/people/_people_table.html.haml load significantly slower than without it.

Environment:
Mac OS X
REE (1.8.7)
Postgresql 8.3
Apache2 with Passenger
Tested in development and production modes with same results.

Probably not a reliable measure but here are snips from production.log where current_objects = 41 people. I've measured larger gaps between the 2 scenarios.

#######With Include method#######
Rendered people/_people_table.html.haml (2579.7ms)
Rendered shared/_alpha_pagination.html.haml (5.1ms)
Rendered layouts/_main_body_no_h2.html.haml (2600.0ms)
Rendered shared/_tagline_and_locales.html.haml (4.2ms)
Rendered shared/_header_nav.html.haml (13.7ms)
Rendered shared/_header_global_nav.html.haml (6.4ms)
Rendered shared/_header.html.haml (280.0ms)
Rendered shared/_flash_messages.html.haml (2.8ms)
Rendered shared/_footer.html.haml (15.7ms)
Rendered people/index.html.haml within layouts/application (2933.6ms)
Completed 200 OK in 3212ms (Views: 2124.5ms | ActiveRecord: 858.5ms)

#######No include#########
Rendered people/_people_table.html.haml (1610.1ms)
Rendered shared/_alpha_pagination.html.haml (6.8ms)
Rendered layouts/_main_body_no_h2.html.haml (1634.0ms)
Rendered shared/_tagline_and_locales.html.haml (3.6ms)
Rendered shared/_header_nav.html.haml (11.8ms)
Rendered shared/_header_global_nav.html.haml (5.8ms)
Rendered shared/_header.html.haml (58.5ms)
Rendered shared/_flash_messages.html.haml (2.4ms)
Rendered shared/_footer.html.haml (14.4ms)
Rendered people/index.html.haml within layouts/application (1925.6ms)
Completed 200 OK in 2217ms (Views: 1574.9ms | ActiveRecord: 414.2ms)