Use for-loop instead of forEach() in a hot path
Summary: public Replaces the usage of forEach() with a for loop on a hot code path Reviewed By: tadeuzagallo Differential Revision: D2690727 fb-gh-sync-id: b7cbcda5cf80a0e31753f49c01e145abb789f3e5
This commit is contained in:
parent
ca016e4eb3
commit
a663d4d8d5
|
@ -121,9 +121,11 @@ var JSTimersExecution = {
|
||||||
var passImmediates = JSTimersExecution.immediates.slice();
|
var passImmediates = JSTimersExecution.immediates.slice();
|
||||||
JSTimersExecution.immediates = [];
|
JSTimersExecution.immediates = [];
|
||||||
|
|
||||||
passImmediates.forEach((timerID) => {
|
// Use for loop rather than forEach as per @vjeux's advice
|
||||||
JSTimersExecution.callTimer(timerID);
|
// https://github.com/facebook/react-native/commit/c8fd9f7588ad02d2293cac7224715f4af7b0f352#commitcomment-14570051
|
||||||
});
|
for (var i = 0; i < passImmediates.length; ++i) {
|
||||||
|
JSTimersExecution.callTimer(passImmediates[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BridgeProfiling.profileEnd();
|
BridgeProfiling.profileEnd();
|
||||||
|
|
Loading…
Reference in New Issue