How to copy data from one grid to another grid

hi,

how to copy data from one grin to another grid. know the below solution

var values = [];

grid1.forEachCell(“rowId”,function(cell){
var value = cell.getValue();
values.push(value);
});

To add the new:

grid2.addRow(rowId,values);

but concern is: number of rows is very large and don’t want to run into performance issue by executing above logic in a for loop.

rgrds
khushhal

If you need to copy all data - you can use something like

targetGridl.parse(sourceGrid.serialize())