bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
12.37k stars 1.58k forks source link

[Android] Patch react-native-svg to cache parsed paths #6583

Closed gaearon closed 3 days ago

gaearon commented 3 days ago

Kind of a hackfix. See https://github.com/software-mansion/react-native-svg/pull/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.

https://github.com/user-attachments/assets/b8b378d0-9898-441a-9406-5617887ca430

Before

This function is a significant part of the createViewInstance trace.

Screenshot 2024-11-21 at 00 40 30

After

It's a smaller part of the overall picture.

Screenshot 2024-11-21 at 01 14 22

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.

github-actions[bot] commented 3 days ago

The Pull Request introduced fingerprint changes against the base commit:

Fingerprint diff ```json [{"type":"dir","filePath":"node_modules/react-native-svg","reasons":["bareRncliAutolinking"],"hash":"2fe338f8d82e5ee1d2f307a81b07a0cb6924fa83"},{"type":"dir","filePath":"patches","reasons":["patchPackage"],"hash":"df78155a2cbb249ca26ea0a2e4d1b54cf88122ae"}] ```

Generated by PR labeler 🤖

github-actions[bot] commented 3 days ago
Old size New size Diff
8.06 MB 8.06 MB 0 B (0.00%)