homebrew's performance is mostly network (git / http / https) and compilation times when needed.
also for some reason homebrew really likes to updates its index all the time (I think it got tamed in the newest version), but setting HOMEBREW_NO_AUTO_UPDATE to 1 helps a lot.
With HOMEBREW_NO_AUTO_UPDATE and HOMEBREW_NO_GITHUB_API, it still gobbles up a core for a full minute to find a substring in a list of strings. Even if it looks through directories for this, I can't imagine how this task would perform so badly. It's not system cpu time primarily.