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

Animated: Store Listeners w/ Map

Open yungsters opened this issue 1 year ago • 1 comments

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

yungsters avatar Sep 06 '24 17:09 yungsters

This pull request was exported from Phabricator. Differential Revision: D62267352

facebook-github-bot avatar Sep 06 '24 17:09 facebook-github-bot