perf: rendering large data (#197)
visibleRowIndices.includes is major culprit in rendering data table. This is because for every row it does this computation, so instead of O(N) operation it becomes O(N^2)
This commit is contained in:
parent
dbde62ce40
commit
bed2708bd5
@ -21,8 +21,11 @@ export default class BodyRenderer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a temporary set for faster lookups.
|
||||||
|
// We can't change this.visibleRowIndices as it would be breaking for users.
|
||||||
|
let visibleRowIndicesSet = new Set(this.visibleRowIndices);
|
||||||
const rowViewOrder = this.datamanager.rowViewOrder.map(index => {
|
const rowViewOrder = this.datamanager.rowViewOrder.map(index => {
|
||||||
if (this.visibleRowIndices.includes(index)) {
|
if (visibleRowIndicesSet.has(index)) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user