5

I'm wondering if having many gems in the Gemfile are slowing down the site? Are they loaded when needed or are all loaded at every page request?

jonepatr
  • 7,769
  • 7
  • 30
  • 53

2 Answers2

7

It really depends on what gems you are using (i.e. middleware vs. just some small library). However in the general case, more gems = more code to process = more time = slower site.

One tip that I can suggest to you is in your Gemfile, do something like this:

gem 'gemname', :require => false

To not have rails require this gem on startup. The downside of course is that you have to manually call require 'gemname' whenever you want to use that gem. It's all a balance of performance vs. ease of use.

Mike Lewis
  • 63,433
  • 20
  • 141
  • 111
2

Bundler what is the require false on the gemfile means

I think that will answer your question.

Community
  • 1
  • 1
Linus Oleander
  • 17,746
  • 15
  • 69
  • 102