Hello everyone, I have read this article about per...
# koin
s
Hello everyone, I have read this article about performance of
Koin
Ref: https://proandroiddev.com/how-dagger-hilt-and-koin-differ-under-the-hood-c3be1a2959d7 Im curious, How can I calculate the performance of Koin in Runtime like this articles? Thanks.
e
Have you looked into the project that the article references? https://github.com/Sloy/android-dependency-injection-performance
a
Take in mind that resolving a Koin instance key is around 0.01 ms. All around is a mater of creating the right instances.
s
Thanks @eurycea @arnaud.giuliani. @arnaud.giuliani You mean this repo is creating the whole keys in the same time => take more time for startup.
a
at startup Koin is just creating all the optimized index key to retrieve a definition instance
it just take a few ms, everything is lazy by default
s
oh I see the startup time / setup koin
<https://github.com/Sloy/android-dependency-injection-performance>
over 0,01 ms. Maybe it is not implement correct way. Some people argue that Koin is not good for startup time , so I would like to check this information. Do you have any best practices link or repository to test the performance in runtime?
a
over 0,01 ms. Maybe it is not implement correct way.
this is the hashmap resolution. There is also a bit around stuff to check before. A resolved instance is around clearly less 0.05 < 0.1 ms. But it scales. requesting in hashmap is effective
startup time has been heavily reworked in 3.1.x, as the indexes are more quickly computed
but yes, we need to declare things at your startup to be able to fetch them
The benchmark doesn’t help really compare the real stuff finally. What’s your time when you “inject” with Dagger by calling your builder. And finally … does it really matter when you request your instance at 0.05 ms?
s
oh yeah!, I think its doesn’t matter when I request a instance in 0,05ms. My project is really big, so Im using Koin 3.x now, How do I calculate the timing of these cases such as startup time, factory, singleton/ inject etc? I need data to report from my research and make a decision to continue using Koin. Some team mems are trusting the above article to switch to Hilt. Thanks.
a
ok, intersting
How do I calculate the timing of these cases such as startup time, factory, singleton/ inject etc?
you can activate logger debug, and track times.
androidLogger(DEBUG)
in your
startKoin
block
s
Thanks @arnaud.giuliani
👍 1
m
Hi @Sam Were you able to calculate the results, we are also discussing about adding Hilt or Koin in our project, but not yet decided.
a
In terms of performances, Koin is resolving as fast as Dagger/Hilt is pushing. Instance access is around 0.05 ms
With Koin you remove all the kapt side and DI config is very minimal
200 Views