You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimize getHashMapFromPropsReadableMap in SurfaceMountingManager (facebook#54358)
Summary:
Pull Request resolved: facebook#54358
Improved the performance of getHashMapFromPropsReadableMap by replacing the iterator-based approach with direct key lookups. The function now directly checks for "transform" and "opacity" keys using hasKey() and getType() instead of iterating through all entries in the ReadableMap.
This optimization reduces the time complexity from O(n) to O(1) for the two specific keys we need, eliminating unnecessary iterations through irrelevant entries. Additionally, the ArrayList for transform is now pre-sized with the correct capacity to avoid reallocations.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D85967272
fbshipit-source-id: 7da60aa6383dd8b5b830f201d5bc66c7ab984572
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,6 @@
60
60
importjava.util.ArrayList;
61
61
importjava.util.HashMap;
62
62
importjava.util.HashSet;
63
-
importjava.util.Iterator;
64
63
importjava.util.LinkedList;
65
64
importjava.util.Map;
66
65
importjava.util.Queue;
@@ -71,6 +70,8 @@ public class SurfaceMountingManager {
0 commit comments