today I want to share results of my investigations of two similar pieces of functionality in Acumatica.
Have you ever wondered which Insert in cache works faster this:
a) var temp = (PRPayrollDetails)PayRollsDetails.Cache.Insert();
b) var temp = new PRPayrollDetails();
temp = (PRPayrollDetails)PayRollsDetails.Cache.Insert(temp);
If to believe to results of Stopwatch, the second part of code works faster. For my set of data, the first one took 5.5 seconds, while the second option took 4.3 seconds. And this is difference for 300 records. If you have any ideas why it can be, you are welcome to share them.
And if I had 250 records then the difference between option a and b is ~4 seconds