
This is a (relatively, for this Bash script) expensive operation that can be trivially cached so: let's do so. Speedup on my machine: ``` $ hyperfine "brew --version" "HOMEBREW_VERSION_CACHE=1 brew --version" Benchmark 1: brew --version Time (mean ± σ): 173.4 ms ± 5.1 ms [User: 28.7 ms, System: 67.0 ms] Range (min … max): 167.3 ms … 182.9 ms 15 runs Benchmark 2: HOMEBREW_VERSION_CACHE=1 brew --version Time (mean ± σ): 145.9 ms ± 4.0 ms [User: 22.4 ms, System: 33.9 ms] Range (min … max): 140.0 ms … 154.5 ms 17 runs Summary HOMEBREW_VERSION_CACHE=1 brew --version ran 1.19 ± 0.05 times faster than brew --version ``` Co-authored-by: Bo Anderson <mail@boanderson.me>
Library
This directory contains all the code run by the official brew
command in Homebrew
and all formulae (package descriptions) in taps (repositories containing formulae) in Taps
subdirectories.