because
gem 'gem_name' # Rails 3.0
or
config.开发者_如何学运维gem 'gem_name' # Rails 2.x
will load the gem no matter what the controller is... will a
require 'gem_name'
in the controller source code actually make the Rails server run faster because not every controller will load that gem?
The short answer is: no.
Stick with keeping your code sane and maintainable by grouping your required gems in your Gemfile
/ environment.rb
.
I would need to see some well crafted performance data before I'd believe that this would ever make a noticeable difference in a production environment. There are so many other places to optimize first.
精彩评论