react-native
react-native copied to clipboard
Animated: Store Listeners w/ Map
Summary:
Currently, AnimatedNode.prototype.getListeners creates an array with Object.keys() to determine the number of listeners.
This is a relatively hot code path for animation-intensive user interfaces. Although Object.keys() is fast, every unnecessary memory allocation is an unnecessary opportunity to create garbage that requires collection.
Using an object as a dictionary performs worst than using a Map anyway, so this switches AnimatedNode to use a Map.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D62267352
This pull request was exported from Phabricator. Differential Revision: D62267352