简体   繁体   中英

Extremely slow bundler 1.0.3 (Bundler.require) with around 100 gems in Rails 3.0.1 and Ruby 1.9.2

I am using Rails 3.0.1, Bundler 1.0.3 and Ruby 1.9.2p0 (2010-08-18 revision 29036). Everything was fine and fast until I started adding Devise & Omniauth. From that on everything involving initializing Bundler (calling Bundler.require as in application.rb) took ages (by means of 30-50 seconds which is a lot for eg calling 'rake routes').

The time is lost in 'config/application.rb':

Bundler.require(:default, Rails.env) if defined?(Bundler)

I tried to disable / enable gems (like the ones I added last or all test-related gems) but it seems as if it is an issue involving a barrier of the amount of total gems rather than any specific coding problems in certain gems.

For final testing I created a fresh Rails 3.0.1 Project with a new RVM gemset and added the gems one by one. Still the same at around 30-50 gems (which is not unusual for large projects and has never before been an issue).

Any ideas (besides: decreasing your gem count)?

Same problem. Adding gems appropriate increase bootup environment time by bundler. I havn't resolved this issue yet. It is about 20 seconds overhead before specs will run. It makes me crazy ;..(

The best I've come up is to utilize spork. It works great and makes up for the slow startup. Spork starts up a DRB Server to which rspec / cucumber can connect and use preloaded ruby processes to run the tests. It reloads certain files (Tests, Classes, ...) for each run, so it is almost as fresh as a new process.

https://github.com/timcharper/spork

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM