Skip to content

Commit

Permalink
Avoid allocating some closures for iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed May 1, 2021
1 parent 0671056 commit 2132302
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addon/components/-private/row-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export default Component.extend({
},

destroy() {
this._cells.forEach(cell => cell.destroy());
for (let cell of this._cells) {
cell.destroy();
}

this._super(...arguments);
},
Expand Down Expand Up @@ -114,7 +116,8 @@ export default Component.extend({
}
}

_cells.forEach((cell, i) => {
for (let i = 0; i < this._cells.length; i++) {
let cell = this._cells[i];
let columnValue = objectAt(columns, i);
let columnMeta = this.get('columnMetaCache').get(columnValue);

Expand All @@ -128,7 +131,7 @@ export default Component.extend({
rowValue,
rowsCount,
});
});
}

return _cells;
}
Expand Down

0 comments on commit 2132302

Please sign in to comment.