Description
I'm using iron-list (v2) to render lists of log data over time. Depending on how noisy the entity being monitored is, the list can grow quite large.
I've found after supplying two lists of 30k+ elements to the iron list, the browser crashes.
This is likely due to the list's use of array-splice.html, which uses a Levenshtein edit distance function (calcEditDistances) to determine which elements need replacing.
The function creates an NxN array as it workspace, which for a 30,000 element list becomes a 900,000,000 entity grid, and consumes 1gig of heap.
Relevant code in array-splice.html:
function calcEditDistances(current, currentStart, currentEnd,
old, oldStart, oldEnd) {
// "Deletion" columns
let rowCount = oldEnd - oldStart + 1;
let columnCount = currentEnd - currentStart + 1;
let distances = new Array(rowCount);
// "Addition" rows. Initialize null column.
for (let i = 0; i < rowCount; i++) { // crashes reliably here
distances[i] = new Array(columnCount);
distances[i][0] = i;
}
Expected outcome
Since the list was working in v1.x, the iron list should still take whatever I throw at it.
Actual outcome
Browser crash.
Live Demo
I'm not at liberty to share
Steps to reproduce
- Put a sized
iron-list element in the page, with a really simple template, a la:
iron-list {
overflow: auto;
height: calc(100vh - 286px);
}
...
<iron-list id="ironList" items="[[data]]">
<template>
<div style="height: 24px">Hey hey hey!</div>
</template>
Note: You can omit any template bindings in the row div.
- Add a button to supply 30k elements on click
- Click the button twice
Browsers Affected
Description
I'm using
iron-list(v2) to render lists of log data over time. Depending on how noisy the entity being monitored is, the list can grow quite large.I've found after supplying two lists of 30k+ elements to the iron list, the browser crashes.
This is likely due to the list's use of array-splice.html, which uses a Levenshtein edit distance function (calcEditDistances) to determine which elements need replacing.
The function creates an NxN array as it workspace, which for a 30,000 element list becomes a 900,000,000 entity grid, and consumes 1gig of heap.
Relevant code in array-splice.html:
Expected outcome
Since the list was working in v1.x, the iron list should still take whatever I throw at it.
Actual outcome
Browser crash.
Live Demo
I'm not at liberty to share
Steps to reproduce
iron-listelement in the page, with a really simple template, a la:Note: You can omit any template bindings in the row div.
Browsers Affected