I previously posted a screenshot showing the magnitude of difference between execution times for various ways of computing some total value.
Here's the relevant source code for the fastest option, ListIntLinqFastLambda. Yes, the names are probably inaccurate.
Parallel.For(0, marx, j =>
{
long subTotal = 0;
li.ForEach(q => subTotal += q);
subTotals[j] = subTotal;
});
subTotals.ForEach(part => total += part);
0 comments:
Post a Comment