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/topics/kotlin-daemon.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,13 @@
1
1
[//]: #(title: Kotlin daemon)
2
2
3
-
The Kotlin daemon is a background process that build systems can use to improve Kotlin compilation performance.
4
-
The Kotlin daemon speeds up build times by keeping the compiler and its environment ready to compile. This approach
5
-
avoids the overhead of starting a new Java Virtual Machine (JVM) instance and reinitializing the compiler for every
6
-
compilation, leading to reduced build times for incremental builds or frequent small changes.
3
+
The Kotlin daemon is a background process that build systems can use to improve build times by keeping the compiler
4
+
and its environment ready to compile. This approach avoids starting a new Java Virtual Machine (JVM)
5
+
instance and reinitializing the compiler for every compilation, leading to reduced build times for incremental builds
6
+
or frequent small changes.
7
7
8
-
Some build systems, like [Gradle](https://docs.gradle.org/current/userguide/gradle_daemon.html) and [Maven](https://maven.apache.org/tools/mvnd.html),
9
-
have their own daemons that help reduce startup costs. However, they miss the added benefit that the Kotlin daemon
10
-
completely isolates the build system process from the compiler. This separation is useful in dynamic environments where
11
-
system settings might change at runtime.
8
+
Some build systems have their own daemons that help reduce startup costs, such as the [Gradle daemon](https://docs.gradle.org/current/userguide/gradle_daemon.html) and the [Maven daemon](https://maven.apache.org/tools/mvnd.html).
9
+
Using the Kotlin daemon instead reduces startup costs while also completely isolating the build system process from the compiler.
10
+
This separation is useful in dynamic environments where system settings might change at runtime.
12
11
13
12
Although the Kotlin daemon has no direct user-facing interface, you can use it through build systems or the [build tools API](build-tools-api.md).
14
13
@@ -46,10 +45,8 @@ For more information, see [`kotlin.daemon.jvmargs` property](gradle-compilation-
46
45
47
46
There are two common lifetime strategies for the Kotlin daemon:
48
47
49
-
***Attached daemon**: Used when the client (like a build system) is long-running. The daemon shuts down shortly after the
50
-
client process shuts down or the daemon hasn't been used for a while.
51
-
***Detached daemon**: Used when the client is short-lived (like command-line compilation). The daemon stays alive longer
52
-
to await potential follow-up requests.
48
+
***Attached daemon**: Shut down the daemon shortly after the client process shuts down or the daemon hasn't been used for a while. Use when the client is long-running.
49
+
***Detached daemon**: Keep the daemon alive longer to await potential follow-up requests. Use when the client is short-lived.
53
50
54
51
To configure the lifetime strategy, you can use the following options:
55
52
@@ -59,7 +56,7 @@ To configure the lifetime strategy, you can use the following options:
59
56
|`autoshutdownUnusedSeconds`| How long a newly started daemon waits for a first client before shutting down if unused. | 1 minute |
60
57
|`shutdownDelayMilliseconds`| How long the daemon waits to shut down after all clients disconnect. | 1 second |
61
58
62
-
To configure an attached daemon lifetime, set `autoshutdownIdleSeconds` to a **high** value and `shutdownDelayMilliseconds` to a **low** value.
59
+
To configure an attached daemon lifetime strategy, set `autoshutdownIdleSeconds` to a **high** value and `shutdownDelayMilliseconds` to a **low** value.
63
60
64
61
<tabsgroup="build-system">
65
62
<tabtitle="Gradle"group-key="gradle">
@@ -82,7 +79,7 @@ Use the following command:
82
79
</tab>
83
80
</tabs>
84
81
85
-
To configure a detached daemon lifetime, set `shutdownDelayMilliseconds` to a **high** value.
82
+
To configure a detached daemon lifetime strategy, set `shutdownDelayMilliseconds` to a **high** value.
0 commit comments