[Android] Patch react-native-svg to cache parsed paths #6583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kind of a hackfix. See software-mansion/react-native-svg#2548.
We don't want to parse these icons' paths every time we create a view with them — this is downright silly.
This caches them forever but it's ok because our SVGs are not dynamic and we have a limited number of them.
Test Plan
Verify we're hitting the cache as expected. As you scroll feed, you have fewer cold parses and soon run out of them.
cache.mov
Before
This function is a significant part of the
createViewInstance
trace.After
It's a smaller part of the overall picture.
Proper fix
This doesn't fully solve the issue — this library is still showing up in
onDraw
, for example. I think ideally we'd move to https://github.com/zamplyy/react-native-vector-image-plugin or something like it, but let's land this for now.