-
Notifications
You must be signed in to change notification settings - Fork 440
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
Add basic internal testing for memory allocations #2097
Conversation
@joelhawksley many production set-ups use jemalloc(its even in the default dockerfile for rails) so it may be usefull to test against it aswell |
@reeganviljoen hmm. I'd worry about forcing folks to set up jemalloc locally in their dev environment to work against these tests. Do you think that'd be too much to ask? |
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.
Awesome!
ViewComponent::CompileCache.cache.delete(MyComponent) | ||
MyComponent.ensure_compiled | ||
|
||
assert_allocations("3.4.0" => 107, "3.3.5" => 116, "3.3.0" => 129, "3.2.5" => 115, "3.1.6" => 115, "3.0.7" => 125) do |
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.
Wow, pretty cool there's a ~15% decrease in allocations from Ruby 3.0 to 3.4 🎉
What are you trying to accomplish?
This PR adds basic internal testing tooling for memory allocations, giving us a starting point for optimizing memory usage in the project.
What approach did you choose and why?
I copied the
assert_allocations
helper from Primer ViewComponents, but modified it to target specific Ruby versions to remove ambiguity.