YairHalberstadt / stronginject

compile time dependency injection for .NET
MIT License
845 stars 24 forks source link

Allow parallelism in async resolution #90

Closed YairHalberstadt closed 3 years ago

YairHalberstadt commented 3 years ago

Currently resolution is linear - dependency 1 is resolved, then dependency 2, then dependency 3, etc.

However when resolution is async, we could kick it off, and then only await it when it's needed, allowing multiple things to be resolved in parallel.

There's 2 parts to this:

  1. Change resolution so it doesn't immediately await dependencies only once they're needed.

  2. Order resolution so that we kick off async tasks as early as possible, and await them as late as possible. I need to think a bit about what algorithm we could use for this.