8000 Use a cache when figuring out if a pod target is test only by dnkoutso · Pull Request #6787 · CocoaPods/CocoaPods · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use a cache when figuring out if a pod target is test only #6787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2017

Conversation

dnkoutso
Copy link
Contributor
@dnkoutso dnkoutso commented Jun 7, 2017

As of CP 1.3.0.beta.1 this method would add 7-10 seconds to out pod install time.

This adds a cache to the result but also prevents a number of calls to this method if they are not needed by short circuiting earlier.

There are no tests for this PR because the logic is the same. I hot patched CocoaPods for us and the pod install now remains the same.

@dnkoutso dnkoutso force-pushed the analyzer_cache branch 2 times, most recently from d87678f to 73d8be7 Compare June 7, 2017 18:11
if @analyzer_cache.key?(key)
return @analyzer_cache[key]
end
source = pod_targets.any? { |pt| pt.dependent_targets.map(&:name).include?(name) }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts welcome on how to combine this perhaps and make it faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 fixing

@@ -46,6 +46,7 @@ def initialize(sandbox, podfile, lockfile = nil)
@update = false
@allow_pre_downloads = true
@has_dependencies = true
@analyzer_cache = {}
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please name this after what it is caching

test = pod_targets.any? { |pt| pt.test_dependent_targets.map(&:name).include?(pod_target.name) }
!source && test
name = pod_target.name
key = [name, pod_targets]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on how often this is hit, it might be worth using a struct as the key instead of an array

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Will attempt it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-->

@segiddins done! Still works :)

@dnkoutso
Copy link
Contributor Author
dnkoutso commented Jun 7, 2017

Fixed the naming problem and rubocop. Looking intro struct way but I think it might be OK anyway.

@dnkoutso
Copy link
Contributor Author
dnkoutso commented Jun 7, 2017

@dnkoutso dnkoutso merged commit 91379dd into CocoaPods:master Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0