only look at latest specs to suggest name #808

Merged
merged 1 commit into from Feb 5, 2014

Conversation

Projects
None yet
5 participants
Contributor

tenderlove commented Feb 5, 2014

This reduced HTTP requests. Reviewed by @zenspider.

There are too many HTTP requests when someone misspells a gem name and that makes the command very slow. Here is the output before my change:

[aaron@higgins rubygems (master)]$ time ruby -I lib bin/gem install minitist -V
HEAD https://api.rubygems.org/api/v1/dependencies
302 Moved Temporarily
HEAD https://bundler.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=minitist
302 Moved Temporarily
GET https://bundler.rubygems.org/api/v1/dependencies?gems=minitist
200 OK
ERROR:  Could not find a valid gem 'minitist' (>= 0) in any repository
GET https://api.rubygems.org/prerelease_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/prerelease_specs.4.8.gz
304 Not Modified
GET https://api.rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
ERROR:  Possible alternatives: minitest, minigit, minilisp, ministat, linguist

real    0m32.252s
user    0m25.878s
sys 0m0.156s
[aaron@higgins rubygems (master)]$

Here it is after my changes:

[aaron@higgins rubygems (faster_error)]$ time ruby -I lib bin/gem install minitist -V
HEAD https://api.rubygems.org/api/v1/dependencies
302 Moved Temporarily
HEAD https://bundler.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=minitist
302 Moved Temporarily
GET https://bundler.rubygems.org/api/v1/dependencies?gems=minitist
200 OK
ERROR:  Could not find a valid gem 'minitist' (>= 0) in any repository
GET https://api.rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
ERROR:  Possible alternatives: minitest, minigit, minilisp, minit, linguist

real    0m10.148s
user    0m3.594s
sys 0m0.094s
[aaron@higgins rubygems (faster_error)]$

Both runs have a heated spec cache, but the new version is ~20 seconds faster.

only look at latest specs to suggest name
This reduced HTTP requests. Reviewed by @zenspider

evanphx added a commit that referenced this pull request Feb 5, 2014

Merge pull request #808 from tenderlove/faster_error
only look at latest specs to suggest name

@evanphx evanphx merged commit 284b226 into rubygems:master Feb 5, 2014

1 check passed

default The Travis CI build passed
Details

👍

drbrain added a commit that referenced this pull request Feb 5, 2014

@drbrain drbrain added this to the 2.3 milestone Feb 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment