react-native-oh-library / react-native-harmony-svg

SVG library for React Native OpenHarmony.
6 stars 29 forks source link

pref: optimize SvgPath parsing logit and add diff to "d" #264

Closed Louis-C7 closed 1 month ago

Louis-C7 commented 1 month ago

Summary

Closed #263

Every time a property is updated, the setD function is triggered to parse the path string, which incurs unnecessary overhead. Before calling setD(), it is advisable to first check if the path string has been updated.

Additionally, BuildFromSvgString() also parses the string, meaning the path string is parsed twice in total, resulting in unnecessary performance degradation. This modification ensures that parsing the path string and obtaining the path object are done simultaneously within setD(), eliminating the need to call BuildFromSvgString().

Test Plan

All SvgPath related section in SvgDemoCase.

Checklist