Remove memoization from uses.rb, as it doesn't result in the expected time complexity savings

This commit is contained in:
richiethomas 2017-10-20 09:36:27 -04:00
parent b135a70c57
commit 43cbf08018
2 changed files with 1 additions and 5 deletions

View File

@ -14,7 +14,7 @@ module Homebrew
def readall
if ARGV.include?("--syntax")
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
ruby_files = Dir.glob(scan_files).reject { |file| file =~ /vendor|cask/ }
ruby_files = Dir.glob(scan_files).reject { |file| file =~ %r{/(vendor|cask)/} }
Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files)
end

View File

@ -54,14 +54,11 @@ module Homebrew
end
ignores << "recommended?" if ARGV.include? "--skip-recommended"
memo = {}
uses = formulae.select do |f|
used_formulae.all? do |ff|
begin
if recursive
deps = f.recursive_dependencies do |dependent, dep|
memo_key = [dependent, dep].to_s
next if memo[memo_key]
if dep.recommended?
Dependency.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
elsif dep.optional?
@ -75,7 +72,6 @@ module Homebrew
if dep.is_a?(TapDependency) && !dep.tap.installed?
Dependency.keep_but_prune_recursive_deps
end
memo[memo_key] = true
end
dep_formulae = deps.flat_map do |dep|