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 коммит произвёл facebook-github-bot-7
Родитель ca016e4eb3
Коммит a663d4d8d5
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

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