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

Pre-loading heavier modules #141

Closed
jmiecz opened this issue Jun 7, 2018 · 9 comments
Closed

Pre-loading heavier modules #141

jmiecz opened this issue Jun 7, 2018 · 9 comments
Labels
core status:accepted accepted to be developed
Milestone

Comments

@jmiecz
Copy link

jmiecz commented Jun 7, 2018

Hello,

Is there a way to pre-load some modules? I've noticed that the UI thread will sometimes lock up for a couple of seconds while Koin is grabbing all the depenicies.

An example would be, having an HttpClient that is used among different services. When you call on the first service, the app will hang while it creates the HttpClient for the 1st time but any calls after will result in 0 delay.

@arnaudgiuliani arnaudgiuliani added this to the 1.0.0 milestone Jun 8, 2018
@arnaudgiuliani
Copy link
Member

Hello @jmiecz,

not available in last 0.9.x version.

For 1.0.0 release, the eager parameter will be added to definitions & modules, to allow a definition/module to be created at start.

@jmiecz
Copy link
Author

jmiecz commented Jun 8, 2018

@arnaudgiuliani Do you happen to have an ETA of when 1.0.0 will drop?

@arnaudgiuliani
Copy link
Member

arnaudgiuliani commented Jun 8, 2018

Target 1.0.0 release is for September: https://github.com/Ekito/koin/milestones

There will be some beta versions before to let you test it.

@jmiecz
Copy link
Author

jmiecz commented Jun 8, 2018

Cool, thanks @arnaudgiuliani !

Side question, will eager help with the frame skipping?

@arnaudgiuliani
Copy link
Member

Frameskip comes from processing in main thread.

Preloading stuff and make load in background thread will help you 👍

@jmiecz
Copy link
Author

jmiecz commented Jun 11, 2018

Sounds good, thanks :D

@johnnycube
Copy link

johnnycube commented Jun 14, 2018

make load in background thread will help you @arnaudgiuliani

How is it possible to load Koin dependencies in the background thread? Something that can be accomplished with Coroutines or RX?

@arnaudgiuliani
Copy link
Member

@johnnycube all definitions are lazy by default. We are currently working on the eager tag.

We will have:

  • a createEagerInstances boolean parameter from startKoin() to directly create eager definitions at start
  • a createEagerInstances() function to call, to create eager instances when you want (and when you don't to create it directly at start)

You will be able to use this last in a background thread.

@arnaudgiuliani
Copy link
Member

available in koin 1.0.0-alpha-18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core status:accepted accepted to be developed
Projects
None yet
Development

No branches or pull requests

3 participants