Skip to content

Commit

Permalink
bring back standard module test
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Sep 4, 2023
1 parent adb8712 commit 3c6d730
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion examples/jvm-perfs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +25,7 @@ object PerfRunner {
fun runScenario(index: Int): Pair<Double, Double> {
val (app, duration) = measureDurationForResult {
koinApplication {
lazyModules(
modules(
perfModule400()
)
}
Expand All @@ -36,9 +34,9 @@ object PerfRunner {

val koin: Koin = app.koin

runBlocking {
koin.awaitAllStartJobs()
}
// runBlocking {
// koin.awaitAllStartJobs()
// }

val (_, executionDuration) = measureDurationForResult {
koinScenario(koin)
Expand Down
Original file line number Diff line number Diff line change
@@ -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()) }
Expand Down

0 comments on commit 3c6d730

Please sign in to comment.