-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Stop allocating the same settings keys repeatedly #6963
Stop allocating the same settings keys repeatedly #6963
Conversation
@technicalpickles you might like this one too :) |
Running `bundle update --bundler` on a rails app locally: ``` ==> memprof.after.txt <== Total allocated: 301.90 kB (3794 objects) Total retained: 73.24 kB (698 objects) ==> memprof.before.txt <== Total allocated: 14.47 MB (196378 objects) Total retained: 25.93 kB (202 objects) ``` So for a slight increase in retained memory (all keys are now retained), we go from about 200k allocations in the settings file to under 4k
750871e
to
e64debb
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.
🚀
Nice work! |
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.
Love to see it 🚀
I did come across part of this, ie the key_for
and those key_to_s
, but didn't have a good solution for it yet.
when Symbol | ||
key.name |
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.
Oh interesting! So this does not end up allocating any extra strings.
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.
yup!
…same-settings-keys-repeatedly Stop allocating the same settings keys repeatedly (cherry picked from commit 92e666f)
…same-settings-keys-repeatedly Stop allocating the same settings keys repeatedly (cherry picked from commit 92e666f)
Running
bundle update --bundler
on a rails app locally:So for a slight increase in retained memory (all keys are now retained),
we go from about 200k allocations in the settings file to under 4k
What was the end-user or developer problem that led to this PR?
What is your fix for the problem, implemented in this PR?
Make sure the following tasks are checked