Adding optional stride length to Parallel.For


It is currently difficult to fully leverage SIMD instructions and Parallelism in .NET. The natural way to accomplish this would be to use a Parallel.For loop over an array, with a stride length equal to Vector<'T>.Count, but as no stride length can be supplied, you have to roll your own Parallel.For.

While you can use an enumerator and a Parallel.ForEach to get this functionality, or by dividing the range and multiplying the index, the overhead of this tends to ruin the performance benefit of the SIMD instructions, for smaller functions.

If there is a better place to request this feature, please let me know.


If you want to request a feature for the .Net Standard Library, the right way is to create an issue on the CoreFX repository on GitHub. If you have a specific proposal, you should follow the API review process.


Also, have you considered using Parallel.ForEach() either with a built-in int range partitioner, or a custom partitioner?

.NET Foundation Website | Blog | Projects | Code of Conduct