I have the following code:
For Each Subitem In lstGastoResumen_Area
Dim MesRealSub
Dim MesPPTOSub
MesRealSub = Aggregate y In lstGastoResumen Where y.Area = Subitem And y.Anio = Anio1 Into Sum(y.FebRealSoles)
MesPPTOSub = Aggregate y In lstGastoResumen Where y.Area = Subitem And y.Anio = Anio1 Into Sum(y.FebPptoSoles)
Next
Where lstGastoResumen
is a hashset and contains more than 80,000 rows and lstGastoResumen_Area
has 20 rows. This code takes 20 seconds to execute.
Could someone tell me how to improve the performance?