theodorzoulias/ParallelLoopLibrary

Optimizations

Closed this issue · 1 comments

Hey, this is a pretty cool library you have here.

I saw you mentioned in the readme that this was not micro-optimized, but looking at the code I saw things that very easily could be optimized. 1) You are duplicating an array on every Add call. 2) You are using boxing which largely defeats the purpose of the generic APIs. 3) You are using closures. All 3 of those can be optimized by using an abstract class as a linked-list node, where the concrete class holds the generic state, instead of an array of structs.

Another thing that could be considered is using my Promise library rather than Tasks. You could virtually eliminate all repeat allocations that way (it uses object pooling). Though the caveat to that is it doesn't support netstandard1.3.

What do you think? I'd be happy to help out.

Hi @timcassell, thanks for the feedback! To be honest I wrote this library mainly for the experience of writing a library, and for learning how GitHub and NuGet work. I didn't expect it to be a particularly useful library, since it offers only few and one-dimensional opportunities for parallelization. So my objective was just to get it working correctly, and not to achieve the theoretically optimal memory efficiency. I am happy with the current state of the library, and I am not motivated to invest time on improving it, at least for the time being.