For DatenMeister, I needed a class which is capable to return all permutations of a list of elements. After using StackOverflow (what else) and other sources I came up with the following implementation:
Partially, I’m quite happy, that parallism is effective up to 80% on a QuadCore processor, on the other side I’m unhappy about a lot of creations of lists to store the subpermutations.
Getting rid of a list for each call would lead to changing instances and make parallelism much harder. For sake of implementation and reduction of complexity every permutation is created during each call.
As surprise, returning predefined permutations (hard-coded up to level of 3) increased the performance in total by more than 30% and activating parallelism just for arrays larger than 7 elements.
During testing, about 2.000.000 permutations could be returned on a 10-element array. Not absolutely performant, but sufficiently performant.
By the way, this is also the first .Net Standard (1.3) Library I ever created. It is runnable under each operation system.