As a summary taken from here.
Both approaches work the same way: the initial collection is split up intro smaller chunks (partitions) and the operations are performed on them, in parallel (probably).
Use PLinq when:
- when there is a need of composition, Linq like constructs are easier to reason about
- when order is important
- the data is simple in nature and the actions are independent
- when operations need to maintain thread-local state
- when you need to break out of the iteration; this can be done either by calling the Break or Stop methods on the ParallelLoopState class
Since the Recursive call is followed by another operation, the current stackframe can’t be reused so, a new Stack Frame is going to be created. This is the root of all possible StackOverflow exceptions.
A trick to get Tail Recursion is to re write the code like
You have the whole story
I am more into doing than having, but a clear goal plus a natural tendency to quickly loose focus brings me to where I am … not there, but here, not doing, but starting new stuff and letting it die all the time.
Something needs to change. Training myself to do stuff for personal rewards is the way I’ll do it. While I am not in need of anything in particular, I don’t long for nothing special and I am pretty generally able to resist temptations, I am tempted today to start something and finish it.
Lets see how it goes.
Best explanation of an Aggregate
“A properly designed aggregate is one that can
be modified in any way required by the business with its invariants completely consistent within a single transaction.”