JetBrains has launched Kotlin 1.4.20, an improve to its language for the JVM, Android, and the browser, with an experimental functionality for JVM-based string concatenation through the dynamic technique invocation main a listing of recent options.
String concatenation on the JVM since JDK 9 has been executed through the dynamic technique invocation, the invokedynamiccode
instruction within the bytecode. This is quicker and consumes much less reminiscence than the earlier implementation and leaves room for future optimizations with no need bytecode adjustments.
This mechanism is now being applied in Kotlin to enhance efficiency. String concatenations now may be compiled into dynamic invocations for JDK 9 or later targets. The experimental function may be invoked for the next use circumstances, through including the -Xstring-concat
possibility:
String.plus i
n the operator (a + bcode), express (a.plus(b)
), and reference ((a::plus)(b)
) types.toString
on inline and information lessons.- String templates, aside from these with a single non-constant argument.
Developers should invoke one of many following guidelines to make use of invokedynamic
:
JetBrains introduced the discharge of Kotlin 1.4.20 on November 23. The command line compiler for Kotlin 1.4.20 may be downloaded from GitHub. IntelliJ Idea and Android Studio IDE customers can discover directions for updating their Kotlin plug-in right here.
Kotlin 1.4.20 additionally options the next:
- For Kotlin/JS, new templates are supplied for the venture wizard. Control over venture configuration has been enhanced through an improved DSL functionality. The IR compiler has been fitted with a brand new solution to compile initiatives, ignoring errors in code.
- The Kotlin/JS Gradle DSL now affords simplified venture setup and customization. Also, a single level is obtainable for webpack configuration.
- The venture wizard for Kotlin has added adjustable templates for Kotlin/JS purposes. Templates are featured for browser, Node.js, and React purposes.
- Entries to the
package deal.json
file may be constituted of the Gradle construct script. - An experimental selective yarn dependency resolutions functionality is featured, configurable from the Gradle construct script.
- The JDK 15 goal has been added.
- Behavior inconsistencies between Kotlin/Native and Kotlin/JVM have been mounted in some nook circumstances, comparable to property initialization. Also for Kotlin/Native, Objective-C exceptions may be wrapped into Kotlin exceptions.
- The commonplace library contains experimental extensions for
java.nio.file.Path.
Also, the efficiency of the…