react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Add cache to StyleSheet color processing

Open ifsnow opened this issue 5 years ago • 3 comments

Summary

In production level projects, colors are used a lot, but there are not so many types of colors.

I think it's inefficient to repeatedly process the same color every time whenever component is created. The results of this process are well worth caching.

Below is the difference between the number of normalizeColor function called for rendering 20 screens. Not surprisingly, the cached version is no longer called at some point.

Version Function calls
Orignal 2,538
Cache 152

Changelog

[Internal] [Changed] - Add cache to StyleSheet color processing

Test Plan

  • Pass the existing test code
  • Check in production level app

ifsnow avatar Jul 24 '20 13:07 ifsnow

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,765,010 85
android hermes armeabi-v7a 6,432,653 64
android hermes x86 7,152,838 79
android hermes x86_64 7,042,740 78
android jsc arm64-v8a 8,936,266 80
android jsc armeabi-v7a 8,596,304 80
android jsc x86 8,767,220 63
android jsc x86_64 9,342,751 63

Base commit: c38b506d7a6609559c70cb3951d62c53c4d78d29

analysis-bot avatar Jul 24 '20 14:07 analysis-bot

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: c38b506d7a6609559c70cb3951d62c53c4d78d29

analysis-bot avatar Jul 24 '20 14:07 analysis-bot

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 15 '23 05:06 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Jun 22 '23 05:06 github-actions[bot]