0

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.

0

1 Answer 1

2

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.

1
  • Thank you so much, that totally makes sense. I didn’t know ruby is interpreted but I can see that being the reason why the command appears less responsive than pre-compiled C or other executables.
    – Joneron
    Apr 8, 2020 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .