perf: don't create holey arrays (#32155)
Don't use `Array` constructor with the size value (ex. `new Array(5)`) - this will create a `HOLEY_ELEMENTS` array (even if this array is filled in later on!); https://v8.dev/blog/elements-kinds https://stackoverflow.com/questions/32054170/how-to-resize-an-array PR Close #32155
This commit is contained in:

committed by
Andrew Kushnir

parent
c957dfc167
commit
64770571b2
@ -50,12 +50,12 @@ export class TableComponent {
|
||||
this._rootEl.appendChild(table);
|
||||
const tbody = document.createElement('tbody');
|
||||
table.appendChild(tbody);
|
||||
this._renderCells = new Array(data.length);
|
||||
this._renderCells = [];
|
||||
for (let r = 0; r < data.length; r++) {
|
||||
const dataRow = data[r];
|
||||
const tr = document.createElement('tr');
|
||||
tbody.appendChild(tr);
|
||||
const renderRow = new Array(dataRow.length);
|
||||
const renderRow = [];
|
||||
this._renderCells[r] = renderRow;
|
||||
for (let c = 0; c < dataRow.length; c++) {
|
||||
const dataCell = dataRow[c];
|
||||
|
Reference in New Issue
Block a user