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

Simplify Tap#formula_files_by_name. #16777

Merged
merged 1 commit into from Mar 1, 2024

Conversation

reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Feb 29, 2024

  • 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?

Extracted from #16730 for easier review.

@@ -1201,7 +1201,6 @@ def self.find_formula_in_tap(name, tap)
"#{name}.rb"
end

Tap.formula_files_by_name(tap)
.fetch(name, tap.formula_dir/filename)
tap.formula_files_by_name.fetch(name, tap.formula_dir/filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tap.formula_files_by_name.fetch(name, tap.formula_dir/filename)
tap.formula_files_by_name.fetch(name) { tap.formula_dir/filename }

To avoid building unnecessary Pathname objects when the name is in the hash.

Copy link
Member

Choose a reason for hiding this comment

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

@apainintheneck same deal as last PR: would like to see something like brew prof show a measurable impact before doing these sorts of micro-optimisations.

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.

Thanks again @reitermarkus!

@@ -1201,7 +1201,6 @@ def self.find_formula_in_tap(name, tap)
"#{name}.rb"
end

Tap.formula_files_by_name(tap)
.fetch(name, tap.formula_dir/filename)
tap.formula_files_by_name.fetch(name, tap.formula_dir/filename)
Copy link
Member

Choose a reason for hiding this comment

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

@apainintheneck same deal as last PR: would like to see something like brew prof show a measurable impact before doing these sorts of micro-optimisations.

@MikeMcQuaid MikeMcQuaid merged commit 0e1c1e3 into Homebrew:master Mar 1, 2024
26 checks passed
@reitermarkus reitermarkus deleted the tap-sig-3 branch March 1, 2024 12:20
apainintheneck added a commit that referenced this pull request Mar 2, 2024
We essentially stopped caching these accidentally and they get
called every time we try to load a cask or formula from the API.
It gets really, really, really slow.

I ran `brew deps --casks --eval-all` before and after the changes.

I let it run for 3 minutes before killing it. No output had been
printed to the screen.

It finished printing all output (pages and pages of it) in less
than a minute.

---

This should match the caching behavior we had before the
recent changes in these two PRs.

- #16777
- #16775
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants