Skip to content

Commit 143f0db

Browse files
wldehqurbonzoda
authored andcommitted
docs: update structure and wording
1 parent c26f523 commit 143f0db

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v?label=Gradle%20Plugin&metadataUrl=https://plugins.gradle.org/m2/org/jetbrains/kotlinx/kotlinx-benchmark-plugin/maven-metadata.xml)](https://plugins.gradle.org/plugin/org.jetbrains.kotlinx.benchmark)
99
[![IR](https://img.shields.io/badge/Kotlin%2FJS-IR%20supported-yellow)](https://kotl.in/jsirsupported)
1010

11-
kotlinx.benchmark is a toolkit for running benchmarks for multiplatform code written in Kotlin and running on the following supported targets: JVM, JavaScript and Native.
11+
kotlinx-benchmark is a toolkit for running benchmarks for multiplatform code written in Kotlin.
1212

1313
## Features
1414

@@ -46,7 +46,7 @@ kotlinx.benchmark is a toolkit for running benchmarks for multiplatform code wri
4646

4747
## Using in Your Projects
4848

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

5151
### Gradle Setup
5252

@@ -149,7 +149,7 @@ You can alternatively mark your benchmark classes and methods `open` manually, b
149149

150150
#### Kotlin/JS
151151

152-
Specify a compiler like the [IR compiler](https://kotlinlang.org/docs/js-ir-compiler.html) and set benchmarking targets in one step. Here, `jsIr` and `jsIrBuiltIn` are both using the IR compiler. The former uses benchmark.js, while the latter uses Kotlin's built-in plugin.
152+
Create a JS target with Node.js execution environment and register it as a benchmark target:
153153

154154
```kotlin
155155
kotlin {
@@ -159,9 +159,17 @@ kotlin {
159159
js('jsIrBuiltIn', IR) {
160160
nodejs()
161161
}
162+
benchmark {
163+
targets {
164+
register("jsIr")
165+
register("jsIrBuiltIn")
166+
}
167+
}
162168
}
163169
```
164170

171+
This setup is using the [IR compiler](https://kotlinlang.org/docs/js-ir-compiler.html). `jsIr` and `jsIrBuiltIn` are both using the IR compiler. The former uses benchmark.js, while the latter uses Kotlin's built-in plugin.
172+
165173
#### Multiplatform
166174

167175
For multiplatform projects, add the `kotlinx-benchmark-runtime` dependency to the `commonMain` source set:
@@ -180,11 +188,9 @@ kotlin {
180188

181189
This setup enables running benchmarks in the main compilation of any registered targets. Another option is to register the compilation you want to run benchmarks from. The platform-specific artifacts will be resolved automatically. For a practical example, please refer to [examples](examples/multiplatform).
182190

183-
### Benchmark Configuration
191+
Note: Benchmark classes located in the common source set will be run in all platforms, while those located in a platform-specific source set will be run in the corresponding platform.
184192

185-
In a `build.gradle` file create `benchmark` section, and inside it add a `targets` section.
186-
In this section register all targets you want to run benchmarks from.
187-
Example for multiplatform project:
193+
Define your benchmark targets within the `benchmark` section in your `build.gradle` file:
188194

189195
```kotlin
190196
benchmark {
@@ -207,6 +213,7 @@ benchmark {
207213
warmups = 20
208214
iterations = 10
209215
iterationTime = 3
216+
iterationTimeUnit = "s"
210217
}
211218
smoke {
212219
warmups = 5

0 commit comments

Comments
 (0)