-
Notifications
You must be signed in to change notification settings - Fork 115
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
Reduce allocations in test/performance/bench_utilities.rb
#2906
Conversation
|
Thanks for this @japf! I just merged main into your branch, which brings support for Ruby 3.3. You should be able to update the tests now. |
👋 @camertron, I merged |
Hey @japf, thanks for that! You'll also need to update the tests to reflect the new number of expected allocations. |
…om:primer/view_components into japf/reduce-allocations-classify-utilities
Ok, it looks like the class name for the new test was |
Huh, so weirdly if I run these new utility allocation tests multiple times, they report different numbers. We might need a warm-up or something before running them. Experimenting now. |
Authors: Please fill out this form carefully and completely.
Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.
What are you trying to accomplish?
This PR is reducing the allocations happening in the
lib/primer/classify/utilities.rb
file. During performance testing, we found that thePrimer::Classify::Utilities.supported_selector?
method was allocating more objects than expected. We have updated the method to use theRegexp
object directly instead of creating a newRegexp
object each time the method is called.Screenshots
N/A
Integration
N/A
List the issues that this change affects.
N/A
Risk Assessment
What approach did you choose and why?
Anything you want to highlight for special attention from reviewers?
Accessibility
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.