-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Restore Config value read performance #149
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.
I'm missing something because it's hard for me to understand why this was needed. Given that we already have _values
why we suddenly also need _configured
? What's the difference between the two?
In #143 I changed how we populated To restore config read performance, in this PR I'm letting The reason we need a separate place to track this is because a user may explicitly assign a value that happens to end up equalling the setting's default value. In that case, we do want to return To put it another way: |
0e30b11
to
4853d71
Compare
@solnic @flash-gordon Folks, this is ready to go. Since it is a fix to a performance regression I'm incline to get it in sooner rather than later and ship a patch release. Please let me know if you have any concerns :) |
Should be no real difference in performance here, but this feels more direct
This allows us to capture all read values into _values, which makes for much faster regular value reads.
This improves performance, and returning a new object isn't critical here
4853d71
to
87b3922
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.
Thanks for the explanation ❤️ 🚀
Return to progressively populating the `_values` hash for _all_ values, regardless of cloneable status. This makes config reads as quick as they were before the changes in #143.
Restore the performance of
Config
on value reads back to its state before #143.Here we capture all values on read to
Config
's internal_values
hash. This means that after first read, all subsequent reads should be fast (This is how it was before #143).Then to preserve the functionality of
#configured?
that we introduced in #143, we keep a separate_configured
Set that tracks the names of values that have either been assigned, or mutable values that have been read. For the very small amount of memory (one set per config object, since most of the names, as symbols, should already be in memory) this is a worthwhile tradeoff for the best possible performance on read, which should reasonably be expected by our users to be as fast as possible.