needle icon indicating copy to clipboard operation
needle copied to clipboard

Generated dependency provider count grows exponentially

Open neakor opened this issue 7 years ago • 1 comments

Since we currently generate a new dependency provider for each scope, for all paths of that scope, this grows exponentially. We should be able to leverage the parent scope's dependency provider to avoid this explosion of generated code.

neakor avatar Jun 08 '18 17:06 neakor

This may or may not yield concrete reduction in generated code. With the current implementation, since dependency providers directly access the source of the dependency object, each provider implementation is relatively small. In order for lower scopes to reuse ancestor's dependency provider to reduce generated code, the ancestor providers would need to aggregate dependencies of its ancestors. This would increase the amount of code generated per dependency provider. If there are a lot of dependencies required by a lot of scopes, then this would yield a reduction in generated code. Otherwise, the current approach would just generate a lot of small classes, which in aggregate might actually be less code.

neakor avatar Jun 08 '18 19:06 neakor