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
@@ -42,17 +44,13 @@ kotlinx-benchmark is a toolkit for running benchmarks for multiplatform code wri
42
44
-[Setting Up a Separate Source Set for Benchmarks](docs/separate-benchmark-source-set.md)
43
45
-[Overview of Tasks Provided by kotlinx-benchmark Gradle Plugin](docs/tasks-overview.md)
44
46
45
-
## Using in Your Projects
46
-
47
-
The `kotlinx-benchmark` library is designed to work with Kotlin/JVM, Kotlin/JS, Kotlin/Native, and Kotlin/Wasm (experimental) targets.
48
-
To get started, ensure you're using Kotlin 1.9.20 or newer and Gradle 7.4 or newer.
47
+
## Setting Up a Kotlin Multiplatform Project for Benchmarking
49
48
50
-
### Project Setup
49
+
To configure a Kotlin Multiplatform project for benchmarking, follow the steps below.
50
+
If you want to benchmark only Kotlin/JVM and Java code, you may refer to our [comprehensive guide](docs/kotlin-jvm-project-setup.md)
51
+
dedicated to setting up benchmarking in those specific project types.
51
52
52
-
Follow the steps below to set up a Kotlin Multiplatform project for benchmarking.
53
-
54
-
<detailsopen>
55
-
<summary>Kotlin DSL</summary>
53
+
<detailsopen><summary>Kotlin DSL</summary>
56
54
57
55
1.**Applying Benchmark Plugin**: Apply the benchmark plugin.
58
56
@@ -98,10 +96,9 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
98
96
}
99
97
```
100
98
101
-
</details>
99
+
</details>
102
100
103
-
<details>
104
-
<summary>GroovyDSL</summary>
101
+
<details><summary>GroovyDSL</summary>
105
102
106
103
1. **ApplyingBenchmarkPlugin**:Apply the benchmark plugin.
107
104
@@ -147,7 +144,7 @@ Follow the steps below to set up a Kotlin Multiplatform project for benchmarking
147
144
}
148
145
```
149
146
150
-
</details>
147
+
</details>
151
148
152
149
### Target-specific configurations
153
150
@@ -191,8 +188,7 @@ To run benchmarks in Kotlin/JVM:
191
188
}
192
189
```
193
190
194
-
<details>
195
-
<summary><b>Explanation</b></summary>
191
+
<details><summary><b>Explanation</b></summary>
196
192
197
193
Assume that you've annotated each of your benchmark classes with `@State(Scope.Benchmark)`:
198
194
@@ -208,8 +204,8 @@ To run benchmarks in Kotlin/JVM:
208
204
}
209
205
```
210
206
211
-
In Kotlin, classes are `final` by default, which means they can't be overridden.
212
-
Thisis incompatible with the operation of the JavaMicrobenchmarkHarness (JMH), which kotlinx-benchmark uses under the hood for running benchmarks on JVM.
207
+
In Kotlin, classes are `final` by default, which means they can't be overridden.
208
+
Thisconflicts with the JavaMicrobenchmarkHarness (JMH) operation, which `kotlinx-benchmark` uses under the hood for running benchmarks on JVM.
213
209
JMH requires benchmark classes and methods to be `open` to be able to generate subclasses and conduct the benchmark.
214
210
215
211
Thisis where the `allopen` plugin comes into play. With the plugin applied, any classannotated with `@State` is treated as `open`, which allows JMH to work as intended:
@@ -307,7 +303,8 @@ To run benchmarks in Kotlin/Wasm:
307
303
}
308
304
```
309
305
310
-
Note:Kotlin/Wasmis an experimental compilation target forKotlin. It may be dropped or changed at any time.
306
+
Note:Kotlin/Wasmis an experimental compilation target forKotlin. It may be dropped or changed at any time. Refer to
307
+
[Kotlin/Wasm documentation](https://kotlinlang.org/docs/wasm-overview.html) for up-to-date information about the target stability.
311
308
312
309
### WritingBenchmarks
313
310
@@ -393,11 +390,11 @@ See [writing benchmarks](docs/writing-benchmarks.md) for a complete guide for wr
393
390
To run your benchmarks in all registered platforms, run `benchmark` Gradle task in your project.
394
391
To run only on a specific platform, run `<target-name>Benchmark`, e.g., `jvmBenchmark`.
395
392
396
-
For more details about the tasks created by the kotlinx-benchmark plugin, refer to [this guide](docs/tasks-overview.md).
393
+
For more details about the tasks created by the `kotlinx-benchmark` plugin, refer to [this guide](docs/tasks-overview.md).
397
394
398
395
### BenchmarkConfigurationProfiles
399
396
400
-
The kotlinx-benchmark library provides the ability to create multiple configuration profiles. The `main` configuration is already created by the Toolkit.
397
+
The`kotlinx-benchmark` library provides the ability to create multiple configuration profiles. The `main` configuration is already created by the toolkit.
401
398
Additional profiles can be created as needed in the `configurations` section of the `benchmark` block:
402
399
403
400
```kotlin
@@ -430,9 +427,9 @@ Refer to our [detailed documentation](docs/separate-benchmark-source-set.md) on
430
427
431
428
## Examples
432
429
433
-
To help you better understand how to use the kotlinx-benchmark library, we've provided an [examples](examples) subproject.
430
+
To help you better understand how to use the `kotlinx-benchmark` library, we've provided an [examples](examples) subproject.
434
431
These examples showcase various use cases and offer practical insights into the library's functionality.
435
432
436
433
## Contributing
437
434
438
-
We welcome contributions to kotlinx-benchmark!If you want to contribute, please refer to our [ContributionGuidelines](CONTRIBUTING.md).
435
+
We welcome contributions to `kotlinx-benchmark`!If you want to contribute, please refer to our [ContributionGuidelines](CONTRIBUTING.md).
0 commit comments