Skip to content

GabrielMajeri/kotlin-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 and Rust using iterators.

Dependencies

You will need:

  • a Java runtime (such as Oracle's JRE on Windows or OpenJDK on Linux)
  • Kotlin
  • Rust
  • GNU Make

Building / Running

Just run make.

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.

About

Calling Rust code from Kotlin

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published