Calling Rust code from Kotlin
Last updated May 7, 2026
80
Stars
5
Forks
0
Issues
0
Stars/day
Attention Score
9
Language breakdown
No language data available.
โธ Files
click to expand
README
Kotlin - Rust interop
This repository contains some sample code for using Rust together with Kotlin.Contents
The app runs a simple micro-benchmark between Kotlin and Rust. It consists of sorting a random string lexicographically.Both the Kotlin and Rust implementation are using functional-programming, with Kotlin using [streams][streams] and Rust using [iterators][iter].
[streams]: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.streams/index.html [iter]: https://doc.rust-lang.org/std/iter/
Dependencies
You will need:Building / Running
Just runmake.
Results
Rust is consistently 3-5 times faster than the equivalent Kotlin code.Support libraries
The jni-rs crate is used in Rust to access JVM types, and a simple Kotlin app loads and runs the Rust code.๐ More in this category