JVM
Android
Browser
Native
Technologie um Kotlin Code zu nativen Binaries zu kompilieren, die ohne VM laufen.
Technologie um Kotlin Code auf unterschiedlichen Plattformen
wiederzuverwenden.
internal expect fun writeLogMessage(message: String, logLevel: LogLevel)
internal actual fun writeLogMessage(message: String, logLevel: LogLevel) {
println("[$logLevel]: $message")
}
Common
internal actual fun writeLogMessage(message: String, logLevel: LogLevel) {
when (logLevel) {
LogLevel.DEBUG -> console.log(message)
LogLevel.WARN -> console.warn(message)
LogLevel.ERROR -> console.error(message)
}
}
expect
actual
Kotlin
Compiler
Java
Compiler
Kotlin
Runtime
*.kt
*.class
*.java
*.jar
Kotlin
Transpiler
*.kt
*.js
*.map
Kotlin Native / Native
JVM
Android
Browser
Native
Kotlin
Compiler
LLVM
Compiler
*.kt
LLVM IR
*.exe
The LLVM Compiler Infrastructure.
IR = Intermediate Representation
Pac-Man
Kotlin JVM
Kotlin Native
Kotlin JS
Android
Desktop
IOS
JAR
APK
Native Exe
Native App
Web
App
Game Wishlist
IntelliJ Launcher - Win 32 API
HitKlack Spiel - Korge
fun main(args: Array<String>) {
val start = getTimeMillis()
var c = 0L
var string = ""
for(i in 0.. 100_000){
c += (i / 2)
c += 1
string += c
}
println( getTimeMillis() - start)
}
BENCHMARK
[ millisekunden / run ] ► weniger ist besser
Kotlin Native | Graal VM | |
---|---|---|
Fokus | Interoperabilität | Polyglot + Performance |
Sprache | Kotlin 1.3 | Java 1.8, R, JS, Python |
Status | Beta | RC15 |
Platform | Win, Linux, Mac, IOS, Android, Embedded | Linux, Mac |
Lizenz | Apache License 2.0 | GPL - Community Ed. |
Kotlin JS Beispiel - Game Wishlist
github.com/TobseF/KotlinJsGameWishlist
Kotlin Native Beispiel - IntelliJ Launcher
github.com/TobseF/IntelliJ-Launcher-n
Multiplatform Beispiel - Hit Klack - Korge