Why do many different brew commands take around one second to execute?

I am regularly using brew on macOS and realised that running any (all?) commands e.g.

  • brew ls
  • brew cask info <cask>
  • brew deps <formula>
  • brew leaves
  • ...

takes about one second to execute in the terminal.

I wondered why this would be the case, specifically because I believe that many of the commands I use have vastly different amount of computation needed to fully execute.

The time it takes to execute the sane command seems to also be very consistent (sample: brew cask info alfred: 1.07s, 1.07s, 1.08s, 1.07s, 1.07s).

So I assume from this, that there is something happening that all brew commands share, that is resulting in the delayed execution of the main task of the command e.g. reading information from a file.

I am sorry, if I have missed something that explains this and have simply not googled the right thing.


Solution 1:

What's your benchmark for comparison? If you are comparing it with other commands available in system or any 3rd party commands, such as git, running Homebrew commands may appear slow, even when the command in question is not accessing the network/Internet.

If it helps, Homebrew commands (verbs) aren't build as native executables, but are Ruby scripts which are interpreted (unlike a native executable for any other command such as git, which is pre-compiled and is executed when run). Executing an interpreted script would most of the times take more time vs running a compiled executable.