Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up brew list #17317

Merged
merged 1 commit into from
May 17, 2024
Merged

Speed up brew list #17317

merged 1 commit into from
May 17, 2024

Conversation

MikeMcQuaid
Copy link
Member

Similarly to have we have with other commands, use Bash to speed it up.

Before:

$ hyperfine "brew list"
Benchmark 1: brew list
  Time (mean ± σ):     559.9 ms ± 122.8 ms    [User: 176.2 ms, System: 126.2 ms]
  Range (min … max):   503.2 ms … 907.3 ms    10 runs

After:

$ hyperfine "brew list"
Benchmark 1: brew list
  Time (mean ± σ):     223.7 ms ±  31.9 ms    [User: 35.0 ms, System: 53.4 ms]
  Range (min … max):   198.1 ms … 302.4 ms    10

Petty after comparison because someone on Homebrew/discussions compared them:

$ hyperfine "brew list" "pip3 list"
Benchmark 1: brew list
  Time (mean ± σ):     213.1 ms ±  22.8 ms    [User: 34.2 ms, System: 49.2 ms]
  Range (min … max):   191.2 ms … 272.3 ms    13 runs

Benchmark 2: pip3 list
  Time (mean ± σ):     271.7 ms ±   4.6 ms    [User: 191.9 ms, System: 40.0 ms]
  Range (min … max):   264.7 ms … 281.4 ms    10 runs

Summary
  brew list ran
    1.28 ± 0.14 times faster than pip3 list

While we're here, also add the HOMEBREW_CASKROOM environment variable to make things a bit cleaner and use --caskroom in documentation.

Library/Homebrew/cmd/list.sh Outdated Show resolved Hide resolved
Library/Homebrew/cmd/list.sh Outdated Show resolved Hide resolved
Library/Homebrew/cmd/list.sh Outdated Show resolved Hide resolved
Library/Homebrew/brew.sh Outdated Show resolved Hide resolved
@MikeMcQuaid MikeMcQuaid force-pushed the list_speedup branch 2 times, most recently from 499be85 to 74a9ab9 Compare May 16, 2024 14:43
@MikeMcQuaid MikeMcQuaid requested a review from carlocab May 16, 2024 14:43
Library/Homebrew/cmd/list.sh Outdated Show resolved Hide resolved
Library/Homebrew/cmd/list.sh Outdated Show resolved Hide resolved
@MikeMcQuaid MikeMcQuaid force-pushed the list_speedup branch 2 times, most recently from 1ee5925 to adb00ff Compare May 16, 2024 15:18
@MikeMcQuaid MikeMcQuaid force-pushed the list_speedup branch 2 times, most recently from 3ce3009 to 475d558 Compare May 17, 2024 03:30
Library/Homebrew/list.sh Outdated Show resolved Hide resolved
@MikeMcQuaid MikeMcQuaid disabled auto-merge May 17, 2024 03:37
Similarly to have we have with other commands, use Bash to speed it up.

Before:
```
$ hyperfine "brew list"
Benchmark 1: brew list
  Time (mean ± σ):     559.9 ms ± 122.8 ms    [User: 176.2 ms, System: 126.2 ms]
  Range (min … max):   503.2 ms … 907.3 ms    10 runs
```

After:
```
$ hyperfine "brew list"
Benchmark 1: brew list
  Time (mean ± σ):     223.7 ms ±  31.9 ms    [User: 35.0 ms, System: 53.4 ms]
  Range (min … max):   198.1 ms … 302.4 ms    10
```

Petty after comparison because someone on Homebrew/discussions compared
them:
```
$ hyperfine "brew list" "pip3 list"
Benchmark 1: brew list
  Time (mean ± σ):     213.1 ms ±  22.8 ms    [User: 34.2 ms, System: 49.2 ms]
  Range (min … max):   191.2 ms … 272.3 ms    13 runs

Benchmark 2: pip3 list
  Time (mean ± σ):     271.7 ms ±   4.6 ms    [User: 191.9 ms, System: 40.0 ms]
  Range (min … max):   264.7 ms … 281.4 ms    10 runs

Summary
  brew list ran
    1.28 ± 0.14 times faster than pip3 list
```

---

While we're here, also add the `HOMEBREW_CASKROOM` environment variable
to make things a bit cleaner and use `--caskroom` in documentation.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
@MikeMcQuaid MikeMcQuaid merged commit a8bf511 into master May 17, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the list_speedup branch May 17, 2024 03:49
@MikeMcQuaid
Copy link
Member Author

Thanks for the help @carlocab!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants