Speed up dependency matching#595
Merged
Merged
Conversation
When searching for a specific name, we can just do a binary search to find the gems by their name, instead of iterating thru all the gems (which takes a long time, since there are over 320,000 gem versions). To do this, we need to sort the tuples by name, which is just a little overhead. Motivation: Gem update took 32 seconds on my machine, when there was nothing to update, only to check if there is a newer version. With the optimized version, it dropped down to 2 seconds.
Contributor
Author
|
Sorry guys, I messed up the original commit, so I created a new pull request. This is using the #bsearch if it is available, otherwise there is no optimization. Probably most of the developers will upgrade to Ruby 2.0.0 soon. I hope. The result is incorrect, if the list is not sorted. I tried to avoid this to happen with the freezing. Though since all tests are passing, it may not be not necessary? |
Member
|
I don't see the need for freezing, so I will remove those after applying. |
drbrain
added a commit
that referenced
this pull request
Jul 16, 2013
Speed up dependency matching through #bsearch
drbrain
added a commit
that referenced
this pull request
Jul 16, 2013
Removed freeze Updated history for #595
drbrain
added a commit
that referenced
this pull request
Sep 9, 2013
When available_specs was introduced it didn't sort the :complete type (which contains sources from two datasets). Binary search was added to speed up extracting only the needed tuples from the result of available_specs (see #595). Binary search depends on a sorted list. The assumption that available_specs returns a sorted list was masked by the tests which sorted the expected value. The other available_specs results are all sorted by default, so this was an easy one to miss on review. Fixes #636
nobu
pushed a commit
to nobu/rubygems
that referenced
this pull request
Jan 12, 2014
nobu
added a commit
to nobu/rubygems
that referenced
this pull request
Feb 7, 2014
nobu
pushed a commit
to nobu/rubygems
that referenced
this pull request
Feb 7, 2014
redmine ruby#595 is not fixed yet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When searching for a specific name, we can just do a binary search to find the gems by their name, instead of iterating thru all the gems (which takes a long time, since there are over 320,000 gem versions).
To do this, we need to sort the tuples by name, which is just a little overhead.
Motivation:
Gem update took 32 seconds on my machine, when there was nothing to update, only to check if there is a newer version.
With the optimized version, it dropped down to 2 seconds.