We now have in our project a class which has 1000 lines of bindPresenter(...)
in its only method that starts when app starts. I'm worried about performance: can such injection slow down application? Am i right that it is not lazy injection and all presentors are creating with all their dependencies at the start of application?
We used profiler and it seems like injection really slow down start, but we are not sure.
I doubt that your 1000 of bind
statements slow down your application's load time. From GWTP's Presenter
docs:
Each presenter is associated to a Proxy which is responsible for listening to the various events of interest for this presenter. This makes it possible to lazily instantiate the presenter and use GWT code splitting.
Since Presenter
s are lazy-instantiated, your slow start might be caused by somthing else.
One thing that might slow down your load time is if you do heavy PresenterWidget
injection, without using Gin's Provider
s:
@Inject
ParentPresenter(
SomePresenterWidget a,
SomePresenterWidget b) {
// ...
}
Injecting many PresenterWidget
s like this requires to build the PresenterWidget
s up front, which might cause loading slowdowns. You could use Provider
s to lazy-load PresenterWidget
s:
@Inject
ParentPresenter(
Provider<SomePresenterWidget> a,
Provider<SomePresenterWidget> b) {
// ...
}
and only instantiate the PresenterWidget
s using provider.get()
when needed.