You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using InversifyJS with the singleton pattern and explicit dependency injection:
The performance should remain consistent regardless of the order of dependencies in the list.
Using container.getAll() to retrieve dependency instances should not cause significant performance degradation, even with complex dependency graphs.
Current Behavior
When modules with more dependencies are placed earlier in the list for explicit injection, it leads to significant performance degradation.
The performance worsens as the number of dependencies and the complexity of the dependency graph increases.
Using container.getAll() to iterate through the list and obtain each dependency instance becomes increasingly slow with larger and more complex dependency lists.
Possible Solution
Optimize the way InversifyJS resolves and instantiates dependencies in the singleton pattern, especially when using container.getAll().
Implement a caching mechanism for resolved dependencies to reduce repeated resolution of complex dependency chains.
Provide an alternative method to container.getAll() that is more efficient for large dependency graphs.
Offer guidance on optimal ordering of dependencies to minimize performance impact.
Steps to Reproduce (for bugs)
Set up a project using InversifyJS with the singleton pattern.
Create a list of dependencies for explicit injection, with modules having varying numbers of dependencies. Ensure some modules have complex dependency chains.
Use container.getAll() to retrieve instances of these dependencies.
Measure performance with different orderings of the dependency list, particularly with more complex dependencies at the beginning vs. the end of the list.
Observe the performance difference and increased resolution time as the list grows and more complex dependencies are moved to the front.
Additional context:
This issue becomes more pronounced in larger applications with numerous dependencies.
The performance impact may vary depending on the specific structure of the dependency graph.
The text was updated successfully, but these errors were encountered:
Expected Behavior
When using InversifyJS with the singleton pattern and explicit dependency injection:
container.getAll()
to retrieve dependency instances should not cause significant performance degradation, even with complex dependency graphs.Current Behavior
container.getAll()
to iterate through the list and obtain each dependency instance becomes increasingly slow with larger and more complex dependency lists.Possible Solution
container.getAll()
.container.getAll()
that is more efficient for large dependency graphs.Steps to Reproduce (for bugs)
container.getAll()
to retrieve instances of these dependencies.Additional context:
The text was updated successfully, but these errors were encountered: