igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Row Selection: bad performance with large amount of data

Open Timmeeeey opened this issue 7 months ago • 0 comments

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: 2024-06-27_14h25_59

With fix: 2024-06-27_14h26_30

Timmeeeey avatar Jun 27 '24 12:06 Timmeeeey