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

How to set Up a Separate Source Set for Benchmarks with an ios/main module #222

Open
vanniktech opened this issue May 28, 2024 · 2 comments

Comments

@vanniktech
Copy link

I have a module with iOS & Android and I'd like to benchmark the commonMain code that gets run on both iOS & Android. There's a docu for Kotlin/JVM project, but I can't seem to find the missing pieces to configure the benchmarking for my module, so far I have this:

kotlin {
+  val commonBench by creating {
+    dependsOn(commonMain)
+    dependencies {
+      implementation(libs.kotlinx.benchmark.runtime)
+    }
+  }
+
+  val androidBench by creating {
+    dependsOn(commonBench)
+    dependsOn(androidMain)
+  }
}

+benchmark {
+  targets {
+    register("androidBench")
+  }
+}

When I sync with IntelliJ I am getting:

The following Kotlin source sets were configured but not added to any Kotlin compilation:
 * androidBench
 * commonBench
You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See https://kotl.in/connecting-source-sets

I've tried a few ways on how to do this in my set up but none worked:

sourceSets {
    create("benchmark")
}

I would expect that my use case would work with kotlinx-benchmark which is a multiplatform benchmarking tool.

@fzhinkin
Copy link
Contributor

@vanniktech, unfortunately, right now kotlinx-benchmark supports neither running benchmarks on iOS devices, nor on Android.
There's a project aimed to support benchmarks execution on Android: https://summerofcode.withgoogle.com/programs/2024/projects/d7VH8Um1.

As of iOS, there were no activity so far (we need to check what should be done for that).

Now, to [I assume] less useful details on project configuration.
For KMP projects, compilations should be configured instead of source set (see https://github.com/Kotlin/kotlinx-benchmark/blob/master/docs/separate-benchmark-source-set.md#kotlin-multiplatform-project).

@vanniktech
Copy link
Author

Alright, I had assumed that from the description Kotlin multiplatform benchmarking toolkit all targets are supported.

Would it make sense to add in this bullet list that neither android nor iOS are currently supported?

Screenshot 2024-05-29 at 20 43 55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants