Files
riteshshukla04 092734772a perf: Cache normalisedColors output (#57896)
Summary:
While looking into something I saw this processColor function , for every color we  are calculating normalise Color even though it would have been done earlier.
This is a simple approach. Maybe we can add things like LRU. With some simple scripts(Rendering around 1000 cells) I found around 13% faster .
## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL][FIXED] - use cached results for already normalised colors

Pull Request resolved: https://github.com/react/react-native/pull/57896

Test Plan: Tested in RN tester.

Reviewed By: christophpurrer

Differential Revision: D115779590

Pulled By: Abbondanzo

fbshipit-source-id: a915bc641fbaff1055c18ac1efa20552a725102f
2026-08-13 08:59:46 -07:00
..

@react-native/normalize-colors

npm npm downloads

Color normalization utility for React Native. Converts CSS color values into the numeric form consumed by the native layer.