igniteui-angular
igniteui-angular copied to clipboard
Row Selection: bad performance with large amount of data
Description
Since version 18.0.1 there is a performance drop in row selection when there are lots of rows.
This is because of the nested this.grid.gridAPI.get_all_data(true).find()
in the this.rowSelection.forEach()
.
https://github.com/IgniteUI/igniteui-angular/blob/7ea822c488140bb2e96e1becfb8abd37cf04489a/projects/igniteui-angular/src/lib/grids/selection/selection.service.ts#L402-L408
This could be significantly improved by creating a map beforehand and using this.
const selection = [];
const gridDataMap = {};
this.grid.gridAPI.get_all_data(true).forEach(row => gridDataMap[this.getRecordKey(row)] === row);
this.rowSelection.forEach(rID => {
const rData = gridDataMap[rID];
const partialRowData = {};
partialRowData[this.grid.primaryKey] = rID;
selection.push(rData ? rData : partialRowData);
});
- igniteui-angular version: 18.0.1
Attachments
Without fix:
With fix: