Compare Kotlin build time and performances on various platforms
APACHE-2.0 License
The purpose of the repository is to compare build time and performances of Kotlin on various platforms:
It is based on simple program generating pairs of twin primes from https://discuss.kotlinlang.org/t/why-is-kotlin-native-much-slower-than-jvm/10226/10.
Platform | Build time | Execution time | Artifact size | Peak RSS |
---|---|---|---|---|
Kotlin/JVM | 3.6s | 1m13s | 1.9 MB + JDK | 398 MB |
GraalVM CE native | 15.9s | 1m40s | 12.4 MB | 60 MB |
GraalVM EE native | 16.5s | 1m33s | 6.8 MB | 59 MB |
Kotlin/Native | 9s | 1m37s | 0.57 MB | 4 MB |
Kotlin/Wasm preview | 5s | 2m49s | 0.18 MB + Node | 120 MB |
Notice I was not able to use a single Gradle multiplatform build due to a conflict between Kotlin/Native and Native Build Tools plugins.
Compile
./mvnw clean package
Run
java -jar target/prime-multiplatform-1.0-SNAPSHOT-jar-with-dependencies.jar
Compile
./mvnw clean native:compile
Run
target/prime-multiplatform
Compile
./gradlew clean linkReleaseExecutableNative
Run
build/bin/native/releaseExecutable/prime-multiplatform.kexe
Compile
./gradlew clean compileProductionExecutableKotlinWasm
Run
./gradlew wasmNodeProductionRun