Rails is not PHP. Some resources are loaded automatically, but all of them that you need are loaded at boot / initialization, because it is better to do this before requests are made so that the application is ready than lazily load them on demand, slowing down the first request. Many of these last minute methods for defining and loading classes still occur, reducing the loading time to 10-15 seconds, but if you reduce 5-10 seconds from this loading time, d are simply bound to the first request. Not good, right?
A lot of the loading time you are experiencing is in the gems / plugins / libraries that you add to your project. Many of the large sizes offer ways to download only the parts you need, and much more can use this optimization. For example, if you have a Rails project that does not require an Active Record, you can replace:
require 'rails/all'
... from:
require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie"
... in your application.rb
to cut down on loading (and avoid missing database errors).
source share