-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Only use MachOShim/ELFShim when required #21071
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
Conversation
There was a problem hiding this 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 optimizes Homebrew's performance by removing the global inclusion of MachOShim and ELFShim in the Pathname class. Instead, these modules are now explicitly extended only when needed on individual Pathname instances, resulting in ~200x faster Pathname object creation.
- Removed global
MachOShim/ELFShiminclusion fromPathnameclass - Updated code to explicitly extend
Pathnameinstances withMachOShimorELFShimwhere binary file operations are needed - Restructured Linux cleaner module to match the Mac cleaner pattern with proper namespacing
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/utils/linkage.rb | Added explicit extension of Pathname with OS-specific shims before checking dynamic libraries |
| Library/Homebrew/test/support/helper/fixtures.rb | Added explicit MachOShim extension to test fixture paths |
| Library/Homebrew/test/os/mac/mach_spec.rb | Added explicit MachOShim extension to test pathnames |
| Library/Homebrew/extend/pathname.rb | Removed global OS-specific pathname extension require |
| Library/Homebrew/extend/os/pathname.rb | Deleted file that globally included OS-specific pathname extensions |
| Library/Homebrew/extend/os/mac/keg_relocate.rb | Added explicit MachOShim extension before checking Mach-O file properties |
| Library/Homebrew/extend/os/mac/extend/pathname.rbi | Deleted type signature file for global MachOShim inclusion |
| Library/Homebrew/extend/os/mac/extend/pathname.rb | Deleted file that globally prepended MachOShim to Pathname |
| Library/Homebrew/extend/os/mac/cleaner.rb | Added explicit MachOShim extension before checking if path is a Mach-O executable |
| Library/Homebrew/extend/os/linux/keg_relocate.rb | Added explicit ELFShim extension before checking ELF file properties |
| Library/Homebrew/extend/os/linux/extend/pathname.rbi | Deleted type signature file for global ELFShim inclusion |
| Library/Homebrew/extend/os/linux/extend/pathname.rb | Deleted file that globally prepended ELFShim to Pathname |
| Library/Homebrew/extend/os/linux/cleaner.rb | Restructured into OS::Linux::Cleaner module and added explicit ELFShim extension |
Files not reviewed (2)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, makes sense to me once CI/copilot comments are resolved!
8f53c75 to
3a383ab
Compare
3a383ab to
7cbd1ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 25 out of 27 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rylan12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really nice improvement!
7cbd1ce to
88d171e
Compare
88d171e to
cab671f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.
Files not reviewed (2)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cab671f to
17824a4
Compare
17824a4 to
9f19617
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 26 out of 28 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9f19617 to
bad399a
Compare
bad399a to
309e32d
Compare
7c765d9 to
3c3bb32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3c3bb32 to
b7dab0d
Compare
b7dab0d to
1a95c12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated no new comments.
Files not reviewed (3)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1a95c12 to
3c74725
Compare
3c74725 to
055fe68
Compare
055fe68 to
c02be20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated no new comments.
Files not reviewed (3)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c02be20 to
73b6aa7
Compare
Not including this globally in `Pathname` speeds up the creation of other `Pathname` objects by ~200x making all of Homebrew faster.
73b6aa7 to
bd4eb5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- Library/Homebrew/extend/os/linux/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/os/mac/extend/pathname.rbi: Language not supported
- Library/Homebrew/extend/pathname.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Maintainers: this shouldn't break anything but, if it does, it should be fairly simple to use |
Not including this globally in
Pathnamespeeds up the creation of otherPathnameobjects by ~200x making all of Homebrew faster.