Paul Krill
Editor at Large

Kotlin 1.4 slated to get a faster compiler

news
Dec 12, 20193 mins

Upgrade to the JVM language due in 2020 will focus on quality and performance rather than adding big features

toned close up of a hand holding a stopwatch 57437132
Credit: Thinkstock

Plans for Kotlin 1.4, an upgrade to the language due in 2020, include reimplementing the compiler to improve execution speed. 

The developers of Kotlin at JetBrains believe that the focus of Kotlin 1.4 should be on “quality and performance” rather than adding “big” features. JetBrains promises the new compiler implementation will “be really fast, unify all the platforms Kotlin supports, and provide an API for compiler extensions.”

The new compiler implementation will be a multi-year effort, with only some parts of the new technology due to arrive in Kotlin 1.4. Specific plans for the compiler involve:

  • Improved performance, which will mostly be derived from a new front-end implementation. It is expected to be about 4.5 times faster than the existing one.
  • Unified back-ends for generating executables, with internal representations (IRs) of Kotlin/JVM and Kotlin/JS being migrated to the same representation as Kotlin/Native. This will result in sharing a lot of back-end logic and a unified pipeline, to allow most features, optimizations, and bug fixes to be done just once for all targets. New back-ends are not likely to be enabled by default in Kotlin 1.4. A common back-end infrastructure opens the possibility of multiplatform compiler extensions. Custom processing and transformations will work on all targets. There is no public API yet for these extensions in version 1.4 but JetBrains is working with partners, including JetPack Compose, who are building plug-ins.
  • Kotlin Library Format (KLib) is being introduced as a library format for Kotlin multiplatform. Serialized IR is contained in a KLib file. Code can add it as a dependency and the compiler back-end will pick it up and generate executable code for a given platform.

With the compiler, JetBrains plans to make new versions of capabilities available while still allowing developers to use older versions for some time. New capabilities will be available in an experimental mode until stable, at which point they will become the default. 

In addition to the new compiler, Kotlin 1.4 also is set to offer the following new language features:

  • SAM (single abstract method) conversions for Kotlin classes. SAM conversion applies if a lambda is passed as an argument when an interface or a class with only one abstract method is expected as a parameter. The compiler converts the lambda to an instance of the class implementing the abstract member function.
  • Optimized delegated properties, an improvement to the way in which the lazy property and other delegated properties are compiled.
  • Trailing commas, a minor syntactic change in which an additional comma can be placed after the last parameter in a parameter list.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author