Will registerProviderFactories spend too much time if we have tons of modules configured dependency by Needle during app cold launch ?
Tommyels opened this issue · 1 comments
Hi,
Thanks for the awesome DI framework. I'm just wondering will app cold start up launch time will spend much time if assume we have tons of Modules configured dependency by Needle (registerProviderFactories should invoked at the very beginning of the app launch ,right ? )? Do you have any suggestion on reduce app code launch time if we use Needle as our DI framework assuming having tons of modules configured?
You're welcome. I need to have better notification filters for github, sorry for the 4 month delay in responding.
Quick answer: In our testing, even with 1,000s of lines in the register function, the total time is quite small (<10ms).
Longer answer: You should profile your startup on a phone with Instruments and the time tracing instrument. For a more rigorous number, you should restart the phone between runs if you really want to know about cold-start performance. I assume that you may not want to run this profile just for the needle register function, so I'd just do it the next time you decide to profile your startup sequence.