Skip to content

Commit 206abb0

Browse files
msandfacebook-github-bot
authored andcommitted
Optimize native animated connection queue handling (#25256)
Summary: Change O(n^2) to O(n) Minor follow-up to: #24177 ## Changelog [Internal] [Changed] - Optimize native animated connection queue handling Pull Request resolved: #25256 Differential Revision: D15804527 Pulled By: cpojer fbshipit-source-id: 4a1e1b51faf6ed7b98eb08aa47e18cfaea541dad
1 parent 874f656 commit 206abb0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Libraries/Animated/src/NativeAnimatedHelper.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ const API = {
4141
disableQueue: function(): void {
4242
invariant(NativeAnimatedModule, 'Native animated module is not available');
4343
queueConnections = false;
44-
while (queue.length) {
45-
const args = queue.shift();
44+
for (let q = 0, l = queue.length; q < l; q++) {
45+
const args = queue[q];
4646
NativeAnimatedModule.connectAnimatedNodes(args[0], args[1]);
4747
}
48+
queue.length = 0;
4849
},
4950
createAnimatedNode: function(tag: ?number, config: AnimatedNodeConfig): void {
5051
invariant(NativeAnimatedModule, 'Native animated module is not available');

0 commit comments

Comments
 (0)