Closed mkozjak closed 3 years ago
Apparently, brew tap
is hoggy here:
time brew tap
aws/tap
dteoh/devdocs
github/gh
homebrew/cask
homebrew/cask-drivers
homebrew/cask-fonts
homebrew/cask-versions
homebrew/core
vitorgalvao/tiny-scripts
yleisradio/terraforms
brew tap 0.54s user 0.34s system 94% cpu 0.936 total
Yes, brew tap
is taking a while. I guess it could be possible to fetch the Tap list directly, but that would break if Homebrew changes its internal implementation.
But I have good news for you if the 1 second wait is too much. 😃
Set the environment variable CHTF_AUTO_INSTALL_METHOD
to homebrew
(or zip
, but probably not your case), and the whole test is skipped.
I'll investigate the Taps listing anyway a bit. And suggestions to improve documentation for this are also welcome.
Wow, there is quite a lot of code in Homebrew! 😅
But I think it is safe to assume that the file hierarchy for Taps would be stable, so we can just look if the essential directory exists. I have a seemingly working solution, but I'll test it a bit more tomorrow with fresh eyes before making a pull request.
@mkozjak You can test #5 if you have time and energy.
make install PREFIX=$(brew --prefix)
in the optimize_brew_tap_check
branch should override the default Homebrew installed version. Of course you can also load the chtf.sh
directly from the cloned repo, or install at other location.
@tmatilai Works nice and also brew --repo
isn't too expensive on my end. Thanks!
time brew --repo
/usr/local/Homebrew
brew --repo 0.01s user 0.02s system 87% cpu 0.036 total
Yeah, brew --repo|caskroom|prefix
are handled in Bash and don't load bunch of Ruby files like brew tap
, so they are fast. We can't skip those, as Homebrew can be installed in custom paths, too. But setting environment variables is always an option.
I guess the loading the (mostly unneeded) libraries is what takes time in brew tap
. And then iterating through directories, but that shouldn't be so bad. Anyway, for us it made unnecessary effort also by dropping the homebrew-
prefixes and sorting, so I feel this is the right thing to do now. So thanks for the initiative!
I'll merge the PR soonish if there are no other comments. But I'll try to get one Fish installation improvement in before cutting the release.
chtf.sh sourcing hangs on this line for quite a while:
+/usr/local/share/chtf/chtf.sh:32> grep -q '^yleisradio/terraforms$'
Time without chtf:
and time with chtf:
This is my zsh zprof with chtf sourcing enabled:
Without: