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();
|
||||
JSTimersExecution.immediates = [];
|
||||
|
||||
passImmediates.forEach((timerID) => {
|
||||
JSTimersExecution.callTimer(timerID);
|
||||
});
|
||||
// Use for loop rather than forEach as per @vjeux's advice
|
||||
// https://github.com/facebook/react-native/commit/c8fd9f7588ad02d2293cac7224715f4af7b0f352#commitcomment-14570051
|
||||
for (var i = 0; i < passImmediates.length; ++i) {
|
||||
JSTimersExecution.callTimer(passImmediates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
BridgeProfiling.profileEnd();
|
||||
|
|
Loading…
Reference in New Issue