Hi! I was wondering if there was a performance gap...
# koin
l
Hi! I was wondering if there was a performance gap between
Copy code
single { ClassA() }  
 // ClassA's using by inject
And
Copy code
single { ClassA(get()) }
g
I don't think so, but i would prefer the second option since if possible (own class not created by a framework), in tests it's easier to mock the dependency. Also if you are changing your service locator / di framework you will have less overhead
a
prefer use DSL + Constructor injection, to have less dependency again Koin’s API
better perfs also
👍 4
(you avoid a lazy delegate access for a direct constructor injection)
👍 3
l
Great! Thanks Arnaud That’s mainly what I thought