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:
Milen Dzhumerov 2015-11-25 07:22:28 -08:00 committed by facebook-github-bot-7
parent ca016e4eb3
commit a663d4d8d5
1 changed files with 5 additions and 3 deletions

View File

@ -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();