@@ -14,8 +14,9 @@ the hoods to run benchmarks on JVM.
14
14
15
15
# Requirements
16
16
17
- Gradle 5.1 or newer
18
- Kotlin 1.3.40 or newer
17
+ Gradle 6.0 or newer
18
+
19
+ Kotlin 1.4.0 or newer
19
20
20
21
# Gradle plugin
21
22
@@ -34,7 +35,7 @@ Use plugin in `build.gradle`:
34
35
35
36
``` groovy
36
37
plugins {
37
- id 'kotlinx.benchmark' version "0.2.0-dev-2 "
38
+ id 'kotlinx.benchmark' version "0.2.0-dev-20 "
38
39
}
39
40
```
40
41
@@ -47,7 +48,7 @@ buildscript {
47
48
maven { url 'https://dl.bintray.com/kotlin/kotlinx' }
48
49
}
49
50
dependencies {
50
- classpath "org.jetbrains.kotlinx:kotlinx.benchmark.gradle:0.2.0-dev-2 "
51
+ classpath "org.jetbrains.kotlinx:kotlinx.benchmark.gradle:0.2.0-dev-20 "
51
52
}
52
53
}
53
54
@@ -67,6 +68,14 @@ kotlin {
67
68
68
69
For Kotlin/JVM code, add ` allopen ` plugin to make JMH happy. Alternatively, make all benchmark classes and methods ` open ` .
69
70
71
+ For example, if you annotated each of your benchmark classes with ` @State(Scope.Benchmark) ` :
72
+ ``` kotlin
73
+ @State(Scope .Benchmark )
74
+ class Benchmark {
75
+ …
76
+ }
77
+ ```
78
+ and added the following code to your ` build.gradle ` :
70
79
``` groovy
71
80
plugins {
72
81
id 'org.jetbrains.kotlin.plugin.allopen'
@@ -76,6 +85,7 @@ allOpen {
76
85
annotation("org.openjdk.jmh.annotations.State")
77
86
}
78
87
```
88
+ then you don't have to make benchmark classes and methods ` open ` .
79
89
80
90
# Runtime Library
81
91
@@ -86,11 +96,23 @@ repositories {
86
96
maven { url 'https://dl.bintray.com/kotlin/kotlinx' }
87
97
}
88
98
89
- dependencies {
90
- implementation "org.jetbrains.kotlinx:kotlinx.benchmark.runtime" version "0.2.0"
99
+ kotlin {
100
+ sourceSets {
101
+ commonMain {
102
+ dependencies {
103
+ implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime:0.2.0-dev-20")
104
+ }
105
+ }
106
+ }
91
107
}
92
108
```
93
109
110
+ To use the library in a JVM-only project add the platform to the artifact name, e.g.:
111
+
112
+ ``` groovy
113
+ implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-20")
114
+ ```
115
+
94
116
# Configuration
95
117
96
118
In a ` build.gradle ` file create ` benchmark ` section, and inside it add a ` targets ` section.
@@ -216,3 +238,8 @@ benchmark {
216
238
}
217
239
}
218
240
```
241
+
242
+ # Examples
243
+
244
+ The project contains [ examples] ( https://github.com/Kotlin/kotlinx-benchmark/tree/master/examples ) subproject that demonstrates using the library.
245
+
0 commit comments