Skip to content

Commit 9adf3fd

Browse files
author
Abduqodiri Qurbonzoda
committed
Update README.md with the latest changes to Kotlin Multiplatform
1 parent 67bd8d9 commit 9adf3fd

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ kotlinx-benchmark is a toolkit for running benchmarks for multiplatform code wri
2626
- [Kotlin/JVM](#kotlinjvm)
2727
- [Kotlin/JS](#kotlinjs)
2828
- [Kotlin/Native](#kotlinnative)
29-
- [Kotlin/WASM](#kotlinwasm)
29+
- [Kotlin/Wasm](#kotlinwasm)
3030
- [Writing Benchmarks](#writing-benchmarks)
3131
- [Running Benchmarks](#running-benchmarks)
3232
- [Benchmark Configuration Profiles](#benchmark-configuration-profiles)
@@ -41,15 +41,15 @@ kotlinx-benchmark is a toolkit for running benchmarks for multiplatform code wri
4141
- [Understanding Benchmark Runtime](docs/benchmark-runtime.md)
4242
- [Configuring kotlinx-benchmark](docs/configuration-options.md)
4343
- [Interpreting and Analyzing Results](docs/interpreting-results.md)
44-
- [Creating Separate Source Sets](docs/seperate-source-sets.md)
44+
- [Creating Separate Source Sets](docs/separate-source-sets.md)
4545
- [Tasks Overview](docs/tasks-overview.md)
4646
- [Compatibility Guide](docs/compatibility.md)
4747
- [Submitting issues and PRs](CONTRIBUTING.md)
4848

4949
## Using in Your Projects
5050

51-
The `kotlinx-benchmark` library is designed to work with Kotlin/JVM, Kotlin/JS, Kotlin/Native, and Kotlin/WASM (experimental) targets.
52-
To get started, ensure you're using Kotlin 1.8.20 or newer and Gradle 8.0 or newer.
51+
The `kotlinx-benchmark` library is designed to work with Kotlin/JVM, Kotlin/JS, Kotlin/Native, and Kotlin/Wasm (experimental) targets.
52+
To get started, ensure you're using Kotlin 1.9.20 or newer and Gradle 7.4 or newer.
5353

5454
### Project Setup
5555

@@ -63,7 +63,7 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
6363
```kotlin
6464
// build.gradle.kts
6565
plugins {
66-
id("org.jetbrains.kotlinx.benchmark") version "0.4.9"
66+
id("org.jetbrains.kotlinx.benchmark") version "0.4.10"
6767
}
6868
```
6969

@@ -86,7 +86,7 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
8686
sourceSets {
8787
commonMain {
8888
dependencies {
89-
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.9")
89+
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.10")
9090
}
9191
}
9292
}
@@ -112,7 +112,7 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
112112
```groovy
113113
// build.gradle
114114
plugins {
115-
id 'org.jetbrains.kotlinx.benchmark' version '0.4.9'
115+
id 'org.jetbrains.kotlinx.benchmark' version '0.4.10'
116116
}
117117
```
118118

@@ -135,7 +135,7 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
135135
sourceSets {
136136
commonMain {
137137
dependencies {
138-
implementation 'org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.9'
138+
implementation 'org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.10'
139139
}
140140
}
141141
}
@@ -187,7 +187,7 @@ To run benchmarks in Kotlin/JVM:
187187
```kotlin
188188
// build.gradle.kts
189189
plugins {
190-
kotlin("plugin.allopen") version "1.8.21"
190+
kotlin("plugin.allopen") version "1.9.20"
191191
}
192192

193193
allOpen {
@@ -205,6 +205,7 @@ To run benchmarks in Kotlin/JVM:
205205
@State(Scope.Benchmark)
206206
class MyBenchmark {
207207
// Benchmarking-related methods and variables
208+
@Benchmark
208209
fun benchmarkMethod() {
209210
// benchmarking logic
210211
}
@@ -220,7 +221,7 @@ To run benchmarks in Kotlin/JVM:
220221
```kotlin
221222
// build.gradle.kts
222223
plugins {
223-
kotlin("plugin.allopen") version "1.8.21"
224+
kotlin("plugin.allopen") version "1.9.20"
224225
}
225226

226227
allOpen {
@@ -242,7 +243,7 @@ To run benchmarks in Kotlin/JS:
242243
```kotlin
243244
// build.gradle.kts
244245
kotlin {
245-
js(IR) {
246+
js {
246247
nodejs()
247248
}
248249
}
@@ -259,8 +260,6 @@ To run benchmarks in Kotlin/JS:
259260
}
260261
```
261262

262-
For Kotlin/JS, only the [IR compiler backend](https://kotlinlang.org/docs/js-ir-compiler.html) is supported.
263-
264263
#### Kotlin/Native
265264

266265
To run benchmarks in Kotlin/Native:
@@ -269,33 +268,34 @@ To run benchmarks in Kotlin/Native:
269268
```kotlin
270269
// build.gradle.kts
271270
kotlin {
272-
linuxX64("native")
271+
linuxX64()
273272
}
274273
```
275274

276-
2. Register `native` as a benchmark target:
275+
2. Register `linuxX64` as a benchmark target:
277276

278277
```kotlin
279278
// build.gradle.kts
280279
benchmark {
281280
targets {
282-
register("native")
281+
register("linuxX64")
283282
}
284283
}
285284
```
286285

286+
It is possible to register multiple native targets. However, benchmarks can be executed only for the host target.
287287
This library supports all [targets supported by the Kotlin/Native compiler](https://kotlinlang.org/docs/native-target-support.html).
288288

289-
#### Kotlin/WASM
289+
#### Kotlin/Wasm
290290

291-
To run benchmarks in Kotlin/WASM:
292-
1. Create a WASM target with D8 execution environment:
291+
To run benchmarks in Kotlin/Wasm:
292+
1. Create a Wasm target with Node.js execution environment:
293293

294294
```kotlin
295295
// build.gradle.kts
296296
kotlin {
297297
wasm {
298-
d8()
298+
nodejs()
299299
}
300300
}
301301
```
@@ -311,7 +311,7 @@ To run benchmarks in Kotlin/WASM:
311311
}
312312
```
313313

314-
Note: Kotlin/WASM is an experimental compilation target for Kotlin. It may be dropped or changed at any time.
314+
Note: Kotlin/Wasm is an experimental compilation target for Kotlin. It may be dropped or changed at any time.
315315

316316
### Writing Benchmarks
317317

@@ -329,9 +329,9 @@ After setting up your project and configuring targets, you can start writing ben
329329
2. **Set up Parameters and Variables**: Define variables needed for the benchmark.
330330

331331
```kotlin
332-
var param: Int = 10
332+
private val size = 10
333333

334-
private var list: MutableList<Int> = ArrayList()
334+
private val list = ArrayList()
335335
```
336336

337337
3. **Initialize Resources**: 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:
364364
@State(Scope.Benchmark)
365365
class MyBenchmark {
366366

367-
var param: Int = 10
367+
private val size = 10
368368

369-
private var list: MutableList<Int> = ArrayList()
369+
private val list = ArrayList()
370370

371371
@Setup
372372
fun prepare() {

0 commit comments

Comments
 (0)