Skip to content

Conversation

@MikeMcQuaid
Copy link
Member

Add the same profilers support as brew prof using test-prof.

While we're here, fix a formula_installer performance issue that added ~0.5s to every call to FormulaInstaller#finish which is a lot of integration tests (already our slowest types).

Copilot AI review requested due to automatic review settings November 14, 2025 17:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds profiling support to brew tests using test-prof and the same profilers available in brew prof (stackprof, vernier, ruby-prof). It also includes a performance optimization in formula_installer.rb that reduces overhead in test execution by checking for caskroom directory existence before attempting to load casks.

  • Adds --stackprof, --vernier, and --ruby-prof switches to the tests command
  • Integrates test-prof gem for test profiling capabilities
  • Optimizes formula_installer.rb to check caskroom path existence before loading casks

Reviewed Changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Library/Homebrew/dev-cmd/tests.rb Adds three new profiler switches with conflicts declaration, installs prof gem group when profilers are enabled, and sets up environment variables and output filenames for each profiler
Library/Homebrew/formula_installer.rb Adds short-circuit check for caskroom directory existence before attempting to load cask, improving performance
Library/Homebrew/Gemfile Adds test-prof gem to both style and tests groups
Library/Homebrew/Gemfile.lock Updates lockfile with test-prof 1.4.4 dependency
Library/Homebrew/test/spec_helper.rb Requires test-prof library for test profiling support
Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi Adds type signatures for new profiler option methods
Library/Homebrew/vendor/bundle/bundler/setup.rb Adds test-prof gem to bundle load path
.gitignore Ignores test profiling output directory and vendored test-prof gem files
Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/tests.rbi: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add the same profilers support as `brew prof` using `test-prof`.

While we're here, fix a `formula_installer` performance issue that
added ~0.5s to every call to `FormulaInstaller#finish` which is a lot
of integration tests (already our slowest types).
Copy link
Member

@p-linnane p-linnane left a comment

Choose a reason for hiding this comment

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

Massive improvement! Thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 14, 2025
@p-linnane p-linnane added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit 597f45b Nov 14, 2025
38 checks passed
@p-linnane p-linnane deleted the faster_tests branch November 14, 2025 20:00
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.

3 participants