Skip to content
Snippets Groups Projects
Commit 6e27e2db authored by Xu Cheng's avatar Xu Cheng
Browse files

tap: cache dir path to avoid duplicated Pathname operations

As discovered in Homebrew/homebrew#50256, this becomes a performance bottleneck as we are
repeating construct same Pathname object.

At the same, this commit makes the behaviors between Tap and CoreTap more
consistence.
parent 760c596a
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,7 @@ class Tap
@remote = nil
@formula_dir = nil
@formula_files = nil
@alias_dir = nil
@alias_files = nil
@aliases = nil
@alias_table = nil
......@@ -298,7 +299,7 @@ class Tap
# path to the directory of all alias files for this {Tap}.
# @private
def alias_dir
path/"Aliases"
@alias_dir ||= path/"Aliases"
end
# an array of all alias files of this {Tap}.
......@@ -500,12 +501,12 @@ class CoreTap < Tap
# @private
def formula_dir
HOMEBREW_LIBRARY/"Formula"
@formula_dir ||= HOMEBREW_LIBRARY/"Formula"
end
# @private
def alias_dir
HOMEBREW_LIBRARY/"Aliases"
@alias_dir ||= HOMEBREW_LIBRARY/"Aliases"
end
# @private
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment