Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will registerProviderFactories spend too much time if we have tons of modules configured dependency by Needle during app cold launch ? #348

Open
Tommyels opened this issue Jun 24, 2020 · 1 comment

Comments

@Tommyels
Copy link

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?

@rudro
Copy link
Collaborator

rudro commented Oct 22, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants