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
gergo
06/21/2019, 8:17 AM
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
arnaud.giuliani
06/21/2019, 8:26 AM
prefer use DSL + Constructor injection, to have less dependency again Koin’s API
arnaud.giuliani
06/21/2019, 8:26 AM
better perfs also
👍 4
arnaud.giuliani
06/21/2019, 8:26 AM
(you avoid a lazy delegate access for a direct constructor injection)