From e7cbcf5670193d7de896bd0de79123aa80d8b0b6 Mon Sep 17 00:00:00 2001 From: Arnaud Giuliani Date: Mon, 4 Sep 2023 10:37:15 +0200 Subject: [PATCH] fix test config --- examples/jvm-perfs/build.gradle.kts | 6 +++--- .../main/kotlin/org/koin/benchmark/BenchmarkClass.kt | 4 ++-- .../src/main/kotlin/org/koin/benchmark/PerfRunner.kt | 10 ++++------ .../src/main/kotlin/org/koin/benchmark/module_400.kt | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/jvm-perfs/build.gradle.kts b/examples/jvm-perfs/build.gradle.kts index 2eddc6120..60b2daed0 100644 --- a/examples/jvm-perfs/build.gradle.kts +++ b/examples/jvm-perfs/build.gradle.kts @@ -16,12 +16,12 @@ tasks.getByName("compileKotlin" } val jmhVersion = "1.36" -val koin_version = "3.4.0" -val coroutines_version = "1.6.4" +//TODO get from existing version.gradle file +val koin_version = "3.5.0" +val coroutines_version = "1.7.3" dependencies { api("io.insert-koin:koin-core:$koin_version") - api("io.insert-koin:koin-core-coroutines:$koin_version") api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.openjdk.jmh:jmh-core:$jmhVersion") kapt("org.openjdk.jmh:jmh-generator-annprocess:$jmhVersion") diff --git a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/BenchmarkClass.kt b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/BenchmarkClass.kt index 9405fe803..34ed14461 100644 --- a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/BenchmarkClass.kt +++ b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/BenchmarkClass.kt @@ -22,14 +22,14 @@ open class BenchmarkClass { @Benchmark fun start400() { koinApplication { - modules(perfModule400().value) + modules(perfModule400()) }.koin } @Benchmark fun start400AndInject() { val koin = koinApplication { - modules(perfModule400().value) + modules(perfModule400()) }.koin koinScenario(koin) } diff --git a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/PerfRunner.kt b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/PerfRunner.kt index 3ac310855..66f1b54ef 100644 --- a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/PerfRunner.kt +++ b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/PerfRunner.kt @@ -5,8 +5,6 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import org.koin.core.Koin import org.koin.core.annotation.KoinExperimentalAPI -import org.koin.core.awaitAllStartJobs -import org.koin.core.lazyModules import org.koin.core.time.measureDurationForResult import org.koin.dsl.koinApplication import kotlin.math.roundToInt @@ -27,7 +25,7 @@ object PerfRunner { fun runScenario(index: Int): Pair { val (app, duration) = measureDurationForResult { koinApplication { - lazyModules( + modules( perfModule400() ) } @@ -36,9 +34,9 @@ object PerfRunner { val koin: Koin = app.koin - runBlocking { - koin.awaitAllStartJobs() - } +// runBlocking { +// koin.awaitAllStartJobs() +// } val (_, executionDuration) = measureDurationForResult { koinScenario(koin) diff --git a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/module_400.kt b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/module_400.kt index 19a74408c..6547e5aa9 100644 --- a/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/module_400.kt +++ b/examples/jvm-perfs/src/main/kotlin/org/koin/benchmark/module_400.kt @@ -1,8 +1,8 @@ package org.koin.benchmark -import org.koin.dsl.lazyModule +import org.koin.dsl.module -fun perfModule400() = lazyModule { +fun perfModule400() = module { single { A1() } single { B1(get()) } single { C1(get(), get()) }