You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -187,7 +187,7 @@ To run benchmarks in Kotlin/JVM:
187
187
```kotlin
188
188
// build.gradle.kts
189
189
plugins {
190
-
kotlin("plugin.allopen") version "1.8.21"
190
+
kotlin("plugin.allopen") version "1.9.20"
191
191
}
192
192
193
193
allOpen {
@@ -205,6 +205,7 @@ To run benchmarks in Kotlin/JVM:
205
205
@State(Scope.Benchmark)
206
206
class MyBenchmark {
207
207
// Benchmarking-related methods and variables
208
+
@Benchmark
208
209
fun benchmarkMethod() {
209
210
// benchmarking logic
210
211
}
@@ -220,7 +221,7 @@ To run benchmarks in Kotlin/JVM:
220
221
```kotlin
221
222
// build.gradle.kts
222
223
plugins {
223
-
kotlin("plugin.allopen") version "1.8.21"
224
+
kotlin("plugin.allopen") version "1.9.20"
224
225
}
225
226
226
227
allOpen {
@@ -242,7 +243,7 @@ To run benchmarks in Kotlin/JS:
242
243
```kotlin
243
244
// build.gradle.kts
244
245
kotlin {
245
-
js(IR) {
246
+
js {
246
247
nodejs()
247
248
}
248
249
}
@@ -259,8 +260,6 @@ To run benchmarks in Kotlin/JS:
259
260
}
260
261
```
261
262
262
-
ForKotlin/JS, only the [IR compiler backend](https://kotlinlang.org/docs/js-ir-compiler.html) is supported.
263
-
264
263
#### Kotlin/Native
265
264
266
265
To run benchmarks inKotlin/Native:
@@ -269,33 +268,34 @@ To run benchmarks in Kotlin/Native:
269
268
```kotlin
270
269
// build.gradle.kts
271
270
kotlin {
272
-
linuxX64("native")
271
+
linuxX64()
273
272
}
274
273
```
275
274
276
-
2. Register `native` as a benchmark target:
275
+
2. Register `linuxX64` as a benchmark target:
277
276
278
277
```kotlin
279
278
// build.gradle.kts
280
279
benchmark {
281
280
targets {
282
-
register("native")
281
+
register("linuxX64")
283
282
}
284
283
}
285
284
```
286
285
286
+
Itis possible to register multiple native targets. However, benchmarks can be executed only for the host target.
287
287
This library supports all [targets supported by the Kotlin/Native compiler](https://kotlinlang.org/docs/native-target-support.html).
288
288
289
-
#### Kotlin/WASM
289
+
#### Kotlin/Wasm
290
290
291
-
To run benchmarks inKotlin/WASM:
292
-
1. Create a WASM target with D8 execution environment:
291
+
To run benchmarks inKotlin/Wasm:
292
+
1. Create a Wasm target with Node.js execution environment:
293
293
294
294
```kotlin
295
295
// build.gradle.kts
296
296
kotlin {
297
297
wasm {
298
-
d8()
298
+
nodejs()
299
299
}
300
300
}
301
301
```
@@ -311,7 +311,7 @@ To run benchmarks in Kotlin/WASM:
311
311
}
312
312
```
313
313
314
-
Note:Kotlin/WASMis an experimental compilation target forKotlin. It may be dropped or changed at any time.
314
+
Note:Kotlin/Wasmis an experimental compilation target forKotlin. It may be dropped or changed at any time.
315
315
316
316
### WritingBenchmarks
317
317
@@ -329,9 +329,9 @@ After setting up your project and configuring targets, you can start writing ben
329
329
2. **Set up ParametersandVariables**:Define variables needed for the benchmark.
330
330
331
331
```kotlin
332
-
var param:Int=10
332
+
privateval size=10
333
333
334
-
privatevar list:MutableList<Int>=ArrayList()
334
+
privateval list =ArrayList()
335
335
```
336
336
337
337
3. **InitializeResources**:Within the class, you can define any setup or teardown methods using `@Setup` and `@TearDown` annotations respectively. These methods will be executed before and after the entire benchmark run.
@@ -364,9 +364,9 @@ Your final benchmark class will look something like this:
0 commit comments