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
Optimize runtime initialization for native components with memoization #44243
base: main
Are you sure you want to change the base?
Conversation
|
@dmytrorykun does this change make sense? |
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.
@admirsaheta it is very likely that this optimization is already happening on a lower level of the framework. E.g. the only caller of getNativeComponentAttributes
already uses cache internally. Are you seeing any reduction of the number of calls to UIManager.getViewManagerConfig
with your changes?
cc @NickGerleman
Good point @dmytrorykun, not really sure however I did fix my issue with patch-package locally in a project this way, see ref. below |
@admirsaheta this error means that the
I don't see how extra caching can fix this. Could that be some other change? |
@admirsaheta you must pass |
This fixes it as well! Thank you 👍 |
Could you describe the improvements in more details?
Re-inits of what exactly? Are you seeing |
Yes! |
@admirsaheta could you please add more details, describe how you test this, and what is the improvement that you're seeing. |
Summary:
This pull request introduces a memoization optimization in the
getNativeComponentAttributes
function to avoid redundant runtime initialization for native components. It introduces a memoization cache (configCache
) to store previously computed configurations, which are then utilized if available before computing a new one.Changelog:
[INTERNAL|GENERAL] [ADDED] - Introduced memoization optimization to
getNativeComponentAttributes
function.Test Plan:
No changes to user interface. The code has been tested locally to ensure that previously computed configurations are utilized when available, reducing redundant computations.