assaf/vanity — pull request #98 by jdelStrother (2012-03-17 18:12:54+00:00)
Title: Lazy-loading Rails frameworks

Hi,
I've spent the past week or two trying to cut down on my Rails app's launch time, and have managed to improve 'rails runner 0' from 22s to 15s. Still not ideal, but it's an improvement...

A big part of the reason for the slowness is due to plugins referencing parts of Rails that don't necessarily need to be loaded, so, eg, ActiveRecord::Base gets pulled in even though I'm just trying to run 'rake routes'. As of Rails 3.0, this can be avoided using on_load hooks.

These commits add a shim for on_load that maintains Rails 2 compatibility, and avoids loading ActionController, ActionMailer, and ActiveRecord until they're needed. What do you think?