From 3b520cf195b6d766d134a1f2bd033347c714a143 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 27 Sep 2015 16:52:14 +0800 Subject: cache taps There are plenty of IO operations inside Tap object, and it will be more when implementing formula alias reverse look up(e.g. list all of alias names for a formula). So let's cache them. Some benchmark: $ time brew info $(brew ruby -e 'puts Formula.tap_names') > /dev/null Before: 6.40s user 2.42s system 96% cpu 9.134 total After: 4.75s user 0.77s system 97% cpu 5.637 total Closes Homebrew/homebrew#44377. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/update.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd/update.rb') diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 917244a8d..b50348bcf 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -63,6 +63,8 @@ module Homebrew end end + Tap.clear_cache + # automatically tap any migrated formulae's new tap report.select_formula(:D).each do |f| next unless (dir = HOMEBREW_CELLAR/f).exist? @@ -372,7 +374,7 @@ class Report user = $1 repo = $2.sub("homebrew-", "") oldname = path.basename(".rb").to_s - next unless newname = Tap.new(user, repo).formula_renames[oldname] + next unless newname = Tap.fetch(user, repo).formula_renames[oldname] else oldname = path.basename(".rb").to_s next unless newname = FORMULA_RENAMES[oldname] -- cgit v1.2.3