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:
parent
7289222535
commit
21c433d998
|
@ -34,7 +34,7 @@ function flattenStyle(style: ?StyleObj): ?Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = {};
|
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]);
|
var computedStyle = flattenStyle(style[i]);
|
||||||
if (computedStyle) {
|
if (computedStyle) {
|
||||||
for (var key in computedStyle) {
|
for (var key in computedStyle) {
|
||||||
|
|
Loading…
Reference in New Issue