Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Source] Fixed slowness.

  • Loading branch information...
commit 131b758a8dcdbd407310622d139eb3144bc94f26 1 parent 8f8e540
@fabiopelosin fabiopelosin authored
Showing with 16 additions and 3 deletions.
  1. +1 −0  CHANGELOG.md
  2. +15 −3 lib/cocoapods/source.rb
View
1  CHANGELOG.md
@@ -15,6 +15,7 @@
[#570](https://github.com/CocoaPods/CocoaPods/issues/570)
- Fixed a crash for `pod outdated`.
[#567](https://github.com/CocoaPods/CocoaPods/issues/567)
+- Fixed an issue that lead to excessively slow sets computation.
## 0.15.0
View
18 lib/cocoapods/source.rb
@@ -128,10 +128,22 @@ def all_pods
# @return [Array<Set>] The sets for all the pods available.
#
+ # @note Implementation detail: The sources don't cache their values
+ # because they might change in response to an update. Therefore
+ # this method to prevent slowness caches the values before
+ # processing them.
+ #
def all_sets
- all_pods.map do |pod|
- sources = all.select{ |s| s.pods.include?(pod) }.compact
- Specification::Set.new(pod, sources)
+ pods_by_source = {}
+ all.each do |source|
+ pods_by_source[source] = source.pods
+ end
+ sources = pods_by_source.keys
+ pods = pods_by_source.values.flatten.uniq
+
+ pods.map do |pod|
+ pod_sources = sources.select{ |s| pods_by_source[s].include?(pod) }.compact
+ Specification::Set.new(pod, pod_sources)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.