Kotlin Pro 1.4-faster compiler

Plans for Kotlin 1.4, an upgrade to Kotlin pro 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 app supports, and provide an API for compiler extensions.”

New Technology is Due to Arrive in Kotlin 1.4

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 program/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 Kotlin pro but JetBrains is working with partners, including JetPack Compose, who are building Kotlin plug-ins.
  • Kotlin Library Format (KLib) is being introduced as a library format for Kotlin pro 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.

New Language Features in Kotlin Pro ver 1.4

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 program 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.

This story, “Kotlin 1.4 slated to get a faster compiler” was originally published by InfoWorld.

A Free Gift for The First Time VisitorsWe appreciate your visit to our website, please enter your favourite email Id to receive this gift right away!

This eBook offers you all those secret SEO tips and tricks to increase conversions that the experts have always tried to hide from the masses.

error: Content is protected !!