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/k2-compiler-migration-guide.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The new architecture and enriched data structure enables the K2 compiler to prov
16
16
***Improved call resolution and type inference**. The compiler behaves more consistently and understands your code better.
17
17
***Easier introduction of syntactic sugar for new language features**. In the future, you'll be able to use more concise,
18
18
readable code when new features are introduced.
19
-
***Faster compilation times**. Compilation times can be significantly faster.
19
+
***Faster compilation times**. Compilation times can be [significantly faster](#performance-improvements).
20
20
***Enhanced IDE performance**. If you enable K2 Kotlin mode in IntelliJ IDEA, then IntelliJ IDEA will use the K2 compiler
21
21
frontend to analyze your Kotlin code, bringing stability and performance improvements. For more information,
22
22
see [Support in IntelliJ IDEA](#support-in-intellij-idea).
@@ -26,8 +26,6 @@ The new architecture and enriched data structure enables the K2 compiler to prov
26
26
>
27
27
{type="warning"}
28
28
29
-
Thanks to the new K2 compiler, we've already made improvements to some [language features](#language-feature-improvements).
30
-
31
29
This guide:
32
30
33
31
* Explains the benefits of the new K2 compiler.
@@ -39,6 +37,22 @@ This guide:
39
37
>
40
38
{type="note"}
41
39
40
+
## Performance improvements
41
+
42
+
To evaluate the performance of the K2 compiler, we ran performance tests on two open-source projects: [Anki-Android](https://github.com/ankidroid/Anki-Android)
43
+
and [Exposed](https://github.com/JetBrains/Exposed). Here are the key performance improvements that we found:
44
+
45
+
* The K2 compiler brings up to 94% compilation speed gains. For example, in the Anki-Android project, clean build times
46
+
were reduced from 57.7 seconds in Kotlin 1.9.23 to 29.7 seconds in Kotlin 2.0.0.
47
+
* The initialization phase is up to 488% faster with the K2 compiler. For example, in the Anki-Android project, the
48
+
initialization phase for incremental builds was cut from 0.126 seconds in Kotlin 1.9.23 to just 0.022 seconds in Kotlin 2.0.0.
49
+
* The Kotlin K2 compiler is up to 376% quicker in the analysis phase compared to the previous compiler. For example,
50
+
in the Anki-Android project, analysis times for incremental builds were slashed from 0.581 seconds in Kotlin 1.9.23 to
51
+
only 0.122 seconds in Kotlin 2.0.0.
52
+
53
+
For more details on these improvements and to learn more about how we analyzed the performance of the K2 compiler, see our
0 commit comments