Caches array length in flattenStyles methods for loop

Summary:Gains minor perf improvement in the for loop by caching the array length
Closes https://github.com/facebook/react-native/pull/6671

Differential Revision: D3102064

fb-gh-sync-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd
fbshipit-source-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd
This commit is contained in:
Manas 2016-03-26 06:53:37 -07:00 committed by Facebook Github Bot 9
parent 7289222535
commit 21c433d998
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ function flattenStyle(style: ?StyleObj): ?Object {
}
var result = {};
for (var i = 0; i < style.length; ++i) {
for (var i = 0, styleLength = style.length; i < styleLength; ++i) {
var computedStyle = flattenStyle(style[i]);
if (computedStyle) {
for (var key in computedStyle) {