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
Copy file name to clipboardExpand all lines: docs/separate-benchmark-module.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,11 @@
2
2
3
3
This guide will walk you through the process of creating a separate module for benchmarks in your Kotlin project.
4
4
Creating a separate module for benchmarks is especially beneficial when you are integrating benchmarks into an existing project.
5
-
Here are a few advantages of doing so:
5
+
Here are a couple of advantages of doing so:
6
6
7
-
1.**Organization**: It helps maintain a clean and organized project structure. Segregating benchmarks from the main code makes it easier to navigate and locate specific code segments.
7
+
1.**Flexibility**: Creating a separate module allows you to manage your benchmarking code independently. You can compile, test, and run benchmarks without impacting your main source code.
8
8
9
-
2.**Isolation**: Separating benchmarks ensures that the benchmarking code does not interfere with your main code or test code. This isolation guarantees accurate measurements without unintentional side effects.
10
-
11
-
3.**Flexibility**: Creating a separate module allows you to manage your benchmarking code independently. You can compile, test, and run benchmarks without impacting your main source code.
9
+
2.**Organization**: It helps maintain a clean and organized project structure. Segregating benchmarks from the main code makes it easier to navigate and locate specific code segments.
12
10
13
11
## Step-by-step Setup Guide
14
12
@@ -18,7 +16,7 @@ Below are the step-by-step instructions to set up a separate module for benchmar
18
16
19
17
Follow these steps to set up a separate compilation for benchmarks:
20
18
21
-
1.**Define New Compilation**:
19
+
1.**Define New Compilation**
22
20
23
21
Start by creating a new compilation in your target of choice (e.g. jvm, js, native, wasm etc.).
24
22
In this example, we're associating the new compilation `benchmark` with the `main` compilation of the `jvm` target.
@@ -37,7 +35,7 @@ Follow these steps to set up a separate compilation for benchmarks:
37
35
}
38
36
```
39
37
40
-
2. **RegisterBenchmarkCompilation**:
38
+
2. **RegisterBenchmarkCompilation**
41
39
42
40
Conclude by registering your new benchmark compilation using its default source set name.
43
41
Inthis instance, `jvmBenchmark` is the name of the default source set of the `benchmark` compilation.
@@ -59,7 +57,7 @@ and the [documentation on associating compiler tasks](https://kotlinlang.org/doc
59
57
60
58
Set up a separate benchmark source set by following these simple steps:
61
59
62
-
1. **DefineSourceSet**:
60
+
1. **DefineSourceSet**
63
61
64
62
Begin by defining a new source set. We'll use `benchmark` as the name for the source set.
65
63
@@ -70,7 +68,7 @@ Set up a separate benchmark source set by following these simple steps:
70
68
}
71
69
```
72
70
73
-
2. **Propagate Dependencies**:
71
+
2. **Propagate Dependencies**
74
72
75
73
Next, propagate dependencies and output from the `main` source set to your `benchmark` source set.
76
74
This ensures the `benchmark` source set has access to classes and resources from the `main` source set.
@@ -85,7 +83,7 @@ Set up a separate benchmark source set by following these simple steps:
85
83
You can also add output and `compileClasspath` from `sourceSets.test` in the same way
86
84
if you wish to reuse some of the test infrastructure.
87
85
88
-
3. **Register Benchmark Source Set**:
86
+
3. **Register Benchmark Source Set**
89
87
90
88
Finally, register your benchmark source set. This informs the kotlinx-benchmark tool
91
89
that benchmarks reside within this source set and need to be executed accordingly.
0 commit comments