I am having performance issues while looping through large data sets (approx. 10k) records in Lightning component Controller using JavaScript.
Below is the object
var wrpr = {Account:Account,Checked:false };
I have a list which has around 10k records of this object. While passing data to the server I need only the Account ids rather than the entire object. To accomplish this I am looping through all the elements in the list and extracting the Account Id as below.
var selectedRecordIds = [];
for (var i = 0; i < allRecords.length; i++) {
if (allRecords[i].Checked) {
selectedRecordIds.push(allRecords[i].Account.Id);
}
}
to execute this loop its taking around 50-60 seconds resulting in bad UI experience. Is there a better way to get the Ids from the object so that it increases the performance?