diff --git a/coroutines/benchmark/build.gradle b/coroutines/benchmark/build.gradle deleted file mode 100644 index ff5f7a313a7..00000000000 --- a/coroutines/benchmark/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "org.jetbrains.kotlin.jvm" -} - -repositories { - mavenCentral() -} - -dependencies { - api project(":micro_utils.coroutines") -} - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} diff --git a/coroutines/benchmark/src/main/kotlin/main.kt b/coroutines/benchmark/src/main/kotlin/main.kt deleted file mode 100644 index eff42d9e874..00000000000 --- a/coroutines/benchmark/src/main/kotlin/main.kt +++ /dev/null @@ -1,56 +0,0 @@ -import dev.inmo.micro_utils.coroutines.SmartSemaphore -import dev.inmo.micro_utils.coroutines.withAcquire -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.CoroutineStart -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.Job -import kotlinx.coroutines.joinAll -import kotlinx.coroutines.launch -import java.io.File -import kotlin.math.tanh -import kotlin.system.measureNanoTime - -data class Record( - val permits: Int, - val i: Int, - val timeNanos: Long -) - -private const val permitsCount = 1000 -private val acquiresCount = 10000 - -suspend fun main(args: Array) { - val outputFilePath = args.firstOrNull() ?: "local.bench.txt" - - val records = ArrayList(permitsCount * acquiresCount) - val jobs = ArrayList() - val scope = CoroutineScope(Dispatchers.Default) - for (permits in 1 .. permitsCount) { - val semaphore = SmartSemaphore.Mutable(permits) - for (i in 0 until acquiresCount) { - jobs.add( - scope.launch(start = CoroutineStart.LAZY) { - val timeNanos = measureNanoTime { - semaphore.withAcquire { - tanh(57.179) - } - } - records.add(Record(permits, i, timeNanos)) - } - ) - } - } - jobs.joinAll() - val file = File(outputFilePath) - file.writeText("") - val text = buildString { - records.groupBy { it.permits }.forEach { - it.value.sortedBy { it.i }.forEach { - append("${it.permits} ${it.i} ${it.timeNanos}\n") - } - } - } - file.appendText(text) - file.appendText("\n") - println(text) -} diff --git a/settings.gradle b/settings.gradle index 29b63586209..908cffc4eae 100644 --- a/settings.gradle +++ b/settings.gradle @@ -35,7 +35,6 @@ String[] includes = [ ":ktor:client", ":coroutines", ":coroutines:compose", - ":coroutines:benchmark", ":android:recyclerview", ":android:pickers", ":android:smalltextfield",