Skip to content

Commit 21c433d

Browse files
ManasJayanthFacebook Github Bot 9
authored andcommitted
Caches array length in flattenStyles methods for loop
Summary:Gains minor perf improvement in the for loop by caching the array length Closes #6671 Differential Revision: D3102064 fb-gh-sync-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd fbshipit-source-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd
1 parent 7289222 commit 21c433d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/StyleSheet/flattenStyle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function flattenStyle(style: ?StyleObj): ?Object {
3434
}
3535

3636
var result = {};
37-
for (var i = 0; i < style.length; ++i) {
37+
for (var i = 0, styleLength = style.length; i < styleLength; ++i) {
3838
var computedStyle = flattenStyle(style[i]);
3939
if (computedStyle) {
4040
for (var key in computedStyle) {

0 commit comments

Comments
 (0)