Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install gems in parallel (faster)

Bundler has a feature where you can install gems in parallel using the --jobs option. For example:

bundle install --jobs 4

Does a similar feature exist for RubyGems?

I want to be able to run gem update in the same way.

The root problem is that it takes FOREVER to update my global system gems.

like image 775
Sean Moubry Avatar asked Jan 14 '16 20:01

Sean Moubry


1 Answers

No, this feature does not currently exist. However, there’s an unmerged pull request on RubyGems regarding downloading gems in parallel that may be integrated by the time you read this: https://github.com/rubygems/rubygems/pull/649. However, this PR does not address the installation of gems in parallel like Bundler does. So, some of functionality might partially be coming soon.

That said, telling RubyGems to do fewer things during installation is a good way to speed up installation. There are three relevant CLI options worth looking at.

  1. Don't install documentation:

    gem update --no-document
    
  2. Don't attempt to upgrade gems already meeting version requirement:

    gem update --conservative
    
  3. Don't upgrade any dependencies that already meet version requirements:

    gem update --minimal-deps
    

I recommend simply installing gems without documentation. The intent behind running a global gem update is usually “just give me all the latest stuff” so limiting the gems you’re updating would be in conflict that goal. However, many people don’t look at the RDocs generated for their installed gems, and it saves a lot of installation time.

http://guides.rubygems.org/command-reference/#gem-update

like image 95
Sean Moubry Avatar answered Nov 09 '22 05:11

Sean Moubry