Performance issue while copying data from one Pagelist to another
I am having 2 Pagelists (both at same class level). Pagelist1 is having 4000 records with say properties fName, lName and Pagelist2 is having 3000 records with say properties contact, address.
My Requirement is to copy contact and address properties from Pagelist2 to Pagelist1.
Currently I am looping through Pagelist1 and using the unique identifier for the records in both the pagelists, I am using IsInPagelistWhen function to identify the common records in both the pagelists and identifying the index, later using this index to copy the data from Pagelist2 using pagelist2.pxResults(Param.Index).contact.
This is my initial solution and technically it is working but performance wise I don't think its a feasible solution which I am already observing.
Looking for any alternate viable solution where performance can be optimized. Thanks
***Edited by Moderator Marissa to update platform capability tags****
If the basic intension is to populate lets say properties C and D present in Pagelist 2 to Pagelist 1 using a common identifer. Then the below solution might be useful,
If we can massage the Pagelist 2 structure into something like a Page Group with the unique identifier. That way we can immediately get rid of the redundant calls for IsInPagelistWhen RUF (to identify the index). Now just loop through the Pagelist 1 and get the properties from the Page Group using the subscript which is the unique identifier.
Thanks! Massaging the pagelist and restructuring it into Pagegroup actually solved the issue. Previously where due to high number of records, I was getting "504 Gateway Timeout", now entire process is completing within 8 seconds. Thanks again for the solution.