Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maintenance] performance forEach on range #1992

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package org.koin.test

import kotlinx.coroutines.runBlocking
import org.koin.core.*
import org.koin.core.context.GlobalContext.startKoin
import org.koin.core.context.GlobalContext.stopKoin
import org.koin.core.context.waitKoinStart
import org.koin.core.logger.*
import org.koin.core.isAllStartedJobsDone
import org.koin.core.lazyModules
import org.koin.core.logger.EmptyLogger
import org.koin.core.logger.Level
import org.koin.core.logger.Logger
import org.koin.core.onKoinStarted
import org.koin.core.runOnKoinStarted
import org.koin.core.time.Timer
import org.koin.core.waitAllStartJobs
import org.koin.dsl.koinApplication
import org.koin.mp.KoinPlatform
import kotlin.test.Test
Expand All @@ -15,12 +21,16 @@ class PerfsTest {

@Test
fun perfModule400_module_perfs() {
(1..3).forEach { runPerfs() }
for (index in 1..3) {
runPerfs()
}
}

@Test
fun perfModule400_lazy_module_perfs() {
(1..3).forEach { runPerfs(isLazy = true) }
for (index in 1..3) {
runPerfs(isLazy = true)
}
}

private fun runPerfs(log: Logger = EmptyLogger(), isLazy: Boolean = false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ParameterStackTest {
)
}.koin

(1..10).forEach {
for (index in 1..10) {
koin.get<Simple.MyStringFactory> { parametersOf(KoinPlatformTools.generateId()) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DebugLogTest {
printLogger(Level.INFO)
}.koin

(1..10).forEach {
for (index in 1..10) {
measureDuration("with if") {
if (koin.logger.isAt(Level.DEBUG)) {
koin.logger.debug(message { "test me" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//package org.koin.core.instance
//
//import org.junit.Assert.*
//import org.junit.Assert.assertEquals
//import org.junit.Assert.assertNotEquals
//import org.junit.Assert.fail
//import org.junit.Test
//import org.koin.core.error.InstanceCreationException
//import org.koin.core.logger.Level
Expand Down Expand Up @@ -123,7 +125,7 @@
// )
// }.koin
//
// (1..3).forEach {
// for (index in 1..3) {
// koin.get<Component>()
// }
// }
Expand Down
Loading