kotlin-native/performance/README.md
To run the benchmarks you need a built Kotlin/Native distribution with the platform libraries:
-Pkotlin.native.home=<path>./gradlew -Pkotlin.native.enabled=true :kotlin-native:dist :kotlin-native:distPlatformLibs
in the root of the git repository (that is in the kotlin folder not in the current kotlin/kotlin-native/performance)
to build the distribution from sourcesTo run all the benchmarks just run ./gradlew :konanRun from this folder. The output will be placed in build/nativeReport.json.
NOTE: consider running with -PdryRun beforehand to build everything before running the benchmarks, this will
make the benchmarking results a bit more stable
To pretty-print the report, or compare different reports, benchmarksAnalyzer can be used.
Run ./gradlew :buildAnalyzer and the analyzer executable will be placed in build/benchmarksAnalyzer.[k]exe.
Passing a single file (e.g. build/benchmarksAnalyzer.kexe <report.json>) pretty-prints the report.
Passing 2 files (e.g. build/benchmarksAnalyzer.kexe <report.json> <baseline-report>.json) will compare
2 reports.
Pass as Gradle Properties (i.e. as -P<option>=<value>):
kotlin.native.home - path to the native distributionnativeWarmup, attempts - configure the warmup and the iteration count of each benchmarkbuildType - whether to build in debug or release (default) modefilter, filterRegex - comma-separated list of benchmarks to rundruRun - only compile the benchmarks, do not run themThe full list can be found here.
Running with --info will enable debugging output in the benchmarks allowing to monitor the progress.
The benchmarks are split into several groups:
ring - regular benchmarksstartup - benchmarks for startup performance and for once-initialized stuff (e.g. Kotlin object {})numerical - compares performance of computational code between pure Kotlin and cinterop-called C codecinterop - benchmarks using C importobjcinterop - benchmarks using ObjC importswiftinterop - benchmarks written in Swift calling Kotlin using ObjC exporthelloworld - compilation time benchmark (compiles hello world with a CLI compiler)./gradlew :konanRun runs all the groups;
use something like ./gradlew :konanRun -Pgroups=ring,startup
to only run a subset of groups. NOTE: -Pgroups= is treated as "enable all groups"