summaryrefslogtreecommitdiff
path: root/buildSrc/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-09-30 10:28:46 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-03 17:17:36 +0200
commit83e6c19681a5cae4b80773f95a66b6753b0bcd7e (patch)
tree655e1675901633fd0ce550ec9a318162c4f56a61 /buildSrc/src
parent54bccf522e169d5cba6489291217f3307ae71094 (diff)
build: Migrate from kotlinx-benchmark to jmh-gradle
This change updates the project to use jmh-gradle for benchmarking as opposed to kotlinx-benchmark. Both plugins use JMH under the hood, but jmh-gradle offers more options for profiling and seems to be beter maintained.
Diffstat (limited to 'buildSrc/src')
-rw-r--r--buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts38
1 files changed, 5 insertions, 33 deletions
diff --git a/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
index 590f51cf..65608e8f 100644
--- a/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
@@ -20,49 +20,21 @@
* SOFTWARE.
*/
-import kotlinx.benchmark.gradle.*
import org.jetbrains.kotlin.allopen.gradle.*
plugins {
- id("org.jetbrains.kotlinx.benchmark")
`java-library`
kotlin("plugin.allopen")
-}
-
-sourceSets {
- register("jmh") {
- compileClasspath += sourceSets["main"].output
- runtimeClasspath += sourceSets["main"].output
- }
-}
-
-configurations {
- named("jmhImplementation") {
- extendsFrom(configurations["implementation"])
- }
+ id("me.champeau.jmh")
}
configure<AllOpenExtension> {
annotation("org.openjdk.jmh.annotations.State")
}
-benchmark {
- targets {
- register("jmh") {
- this as JvmBenchmarkTarget
- jmhVersion = "1.33"
- }
- }
-}
-
-dependencies {
- val libs = Libs(project)
- implementation(libs["kotlinx.benchmark.runtime.jvm"])
-}
+jmh {
+ jmhVersion.set("1.33")
-// Workaround for https://github.com/Kotlin/kotlinx-benchmark/issues/39
-afterEvaluate {
- tasks.named<org.gradle.jvm.tasks.Jar>("jmhBenchmarkJar") {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- }
+ profilers.add("stack")
+ profilers.add("gc")
}