Skip to content

Commit 3447096

Browse files
author
Arnaud Giuliani
committed
update for Koin 2.1.4
1 parent 45512f5 commit 3447096

File tree

6 files changed

+52
-17
lines changed

6 files changed

+52
-17
lines changed

README.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ Results can be quite different between different devices, so here are some resul
2929
- [OnePlus 5](#oneplus-5)
3030
- [Nexus 6](#nexus-6)
3131

32-
### LG G4
32+
### lge p1 with Android 6.0
3333

34+
Koin 2.0
3435
Library | Setup Kotlin | Setup Java | Inject Kotlin | Inject Java
3536
--- | ---:| ---:| ---:| ---:
3637
**Custom** | 2.05 ms | 2.13 ms | 0.30 ms | 0.36 ms
@@ -39,12 +40,33 @@ Library | Setup Kotlin | Setup Java | Inject Kotlin | Inject Java
3940
**Katana** | 5.37 ms | 5.84 ms | 0.82 ms | 0.77 ms
4041
**Dagger** | 0.01 ms | 0.01 ms | 0.13 ms | 0.09 ms
4142

42-
### Nokia 7p
43+
Koin 2.1
44+
Library | Setup Kotlin | Setup Java | Inject Kotlin | Inject Java
45+
--- | ---:| ---:| ---:| ---:
46+
**Custom** | 0.47 ms | 0.45 ms | 0.07 ms | 0.08 ms
47+
**Koin** | 4.11 ms | 4.19 ms | 0.29 ms | 0.28 ms
48+
**Kodein** | 14.50 ms | 14.58 ms | 0.77 ms | 0.78 ms
49+
**Katana** | 1.55 ms | 1.49 ms | 0.19 ms | 0.18 ms
50+
**Dagger** | 0.00 ms | 0.00 ms | 0.02 ms | 0.02 ms
51+
52+
### HONOR HNKIW-Q with Android 6.0.1
53+
54+
Koin 2.1
55+
Library | Setup Kotlin | Setup Java | Inject Kotlin | Inject Java
56+
--- | ---:| ---:| ---:| ---:
57+
**Custom** | 0.46 ms | 0.41 ms | 0.06 ms | 0.08 ms
58+
**Koin** | 3.40 ms | 3.54 ms | 0.24 ms | 0.23 ms
59+
**Kodein** | 11.48 ms | 11.68 ms | 0.62 ms | 0.65 ms
60+
**Katana** | 1.60 ms | 1.61 ms | 0.15 ms | 0.14 ms
61+
**Dagger** | 0.00 ms | 0.00 ms | 0.02 ms | 0.02 ms
62+
63+
### Nokia B2N_sprout with Android 10
4364

65+
Koin 2.1
4466
Library | Setup Kotlin | Setup Java | Inject Kotlin | Inject Java
4567
--- | ---:| ---:| ---:| ---:
46-
**Custom** | 0.11 ms | 0.09 ms | 0.06 ms | 0.06 ms
47-
**Koin** | 0.53 ms | 0.49 ms | 0.08 ms | 0.06 ms
48-
**Kodein** | 5.41 ms | 5.24 ms | 0.12 ms | 0.09 ms
49-
**Katana** | 0.37 ms | 0.36 ms | 0.06 ms | 0.10 ms
50-
**Dagger** | 0.01 ms | 0.01 ms | 0.05 ms | 0.05 ms
68+
**Custom** | 0.09 ms | 0.09 ms | 0.12 ms | 0.08 ms
69+
**Koin** | 0.66 ms | 0.74 ms | 0.12 ms | 0.11 ms
70+
**Kodein** | 5.10 ms | 5.59 ms | 0.21 ms | 0.10 ms
71+
**Katana** | 0.47 ms | 0.42 ms | 0.12 ms | 0.10 ms
72+
**Dagger** | 0.00 ms | 0.00 ms | 0.04 ms | 0.04 ms

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
implementation 'com.google.android.material:material:1.0.0'
2929

3030
// Koin
31-
implementation "org.koin:koin-core:2.0.1"
31+
implementation "org.koin:koin-core:2.1.4"
3232

3333
// Kodein
3434
implementation 'org.kodein.di:kodein-di-erased-jvm:5.3.0'

app/src/main/java/com/sloydev/dependencyinjectionperformance/InjectionTest.kt

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import org.kodein.di.Kodein
1616
import org.kodein.di.direct
1717
import org.kodein.di.erased.instance
1818
import org.koin.core.Koin
19+
import org.koin.core.context.startKoin
1920
import org.koin.core.context.stopKoin
20-
import org.koin.dsl.koinApplication
2121
import org.rewedigital.katana.Component
2222
import org.rewedigital.katana.Katana
2323
import org.rewedigital.katana.android.environment.AndroidEnvironmentContext
@@ -74,19 +74,21 @@ class InjectionTest {
7474
return LibraryResult("Koin", mapOf(
7575
Variant.KOTLIN to runTest(
7676
setup = {
77-
koin = koinApplication {
77+
koin = startKoin {
7878
modules(koinKotlinModule)
7979
}.koin
8080
},
81-
test = { koin.get<Fib8>() }
81+
test = { koin.get<Fib8>() },
82+
teardown = { stopKoin() }
8283
),
8384
Variant.JAVA to runTest(
8485
setup = {
85-
koin = koinApplication {
86+
koin = startKoin {
8687
modules(koinJavaModule)
8788
}.koin
8889
},
89-
test = { koin.get<FibonacciJava.Fib8>() }
90+
test = { koin.get<FibonacciJava.Fib8>() },
91+
teardown = { stopKoin() }
9092
)
9193
))
9294
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.sloydev.dependencyinjectionperformance
2+
3+
import com.sloydev.dependencyinjectionperformance.koin.koinKotlinModule
4+
import org.koin.dsl.koinApplication
5+
6+
fun main(vararg args: String) {
7+
val koin = koinApplication {
8+
modules(koinKotlinModule)
9+
}.koin
10+
koin.get<Fib8>()
11+
}

build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.11'
2+
ext.kotlin_version = '1.3.70'
33
repositories {
44
google()
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.2.1'
8+
classpath 'com.android.tools.build:gradle:3.5.3'
99
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1010
}
1111
}
1212

1313
allprojects {
1414
repositories {
15-
mavenLocal()
15+
// mavenLocal()
1616
google()
1717
jcenter()
1818
maven { url 'https://jitpack.io' }
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)