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 tap for no arguments #18402

Merged
merged 6 commits into from
Sep 25, 2024
Merged

Speed up brew tap for no arguments #18402

merged 6 commits into from
Sep 25, 2024

Conversation

ZhongRuoyu
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This provides a >3x speedup for brew tap with no arguments (i.e., when listing taps). It also makes the completion significantly faster.

$ hyperfine --warmup=3 --setup 'git checkout {branch}' --parameter-list branch master,brew-tap-speedup 'brew tap'
Benchmark 1: brew tap (branch = master)
  Time (mean ± σ):      1.405 s ±  0.080 s    [User: 0.561 s, System: 0.238 s]
  Range (min … max):    1.332 s …  1.549 s    10 runs

Benchmark 2: brew tap (branch = brew-tap-speedup)
  Time (mean ± σ):     404.1 ms ± 124.8 ms    [User: 107.9 ms, System: 200.7 ms]
  Range (min … max):   308.8 ms … 693.7 ms    10 runs

Summary
  brew tap (branch = brew-tap-speedup) ran
    3.48 ± 1.09 times faster than brew tap (branch = master)

This provides a >3x speedup for `brew tap` with no arguments (i.e., when
listing taps). It also makes the completion significantly faster.

    $ hyperfine --warmup=3 --setup 'git checkout {branch}' --parameter-list branch master,brew-tap-speedup 'brew tap'
    Benchmark 1: brew tap (branch = master)
      Time (mean ± σ):      1.405 s ±  0.080 s    [User: 0.561 s, System: 0.238 s]
      Range (min … max):    1.332 s …  1.549 s    10 runs

    Benchmark 2: brew tap (branch = brew-tap-speedup)
      Time (mean ± σ):     404.1 ms ± 124.8 ms    [User: 107.9 ms, System: 200.7 ms]
      Range (min … max):   308.8 ms … 693.7 ms    10 runs

    Summary
      brew tap (branch = brew-tap-speedup) ran
        3.48 ± 1.09 times faster than brew tap (branch = master)
Copy link
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

Library/Homebrew/tap.sh Outdated Show resolved Hide resolved
Co-authored-by: Carlo Cabrera <[email protected]>
Library/Homebrew/brew.sh Outdated Show resolved Hide resolved
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, thanks @ZhongRuoyu! A few more tweaks and then should be good to go.

Library/Homebrew/tap.sh Outdated Show resolved Hide resolved
Library/Homebrew/tap.sh Outdated Show resolved Hide resolved
Library/Homebrew/tap.sh Outdated Show resolved Hide resolved
Library/Homebrew/brew.sh Outdated Show resolved Hide resolved
Library/Homebrew/tap.sh Outdated Show resolved Hide resolved
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thanks @ZhongRuoyu!

@MikeMcQuaid MikeMcQuaid merged commit 90597f7 into master Sep 25, 2024
27 checks passed
@MikeMcQuaid MikeMcQuaid deleted the brew-tap-speedup branch September 25, 2024 09:41
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.

4 participants