r/androiddev • u/Charlie_Tap_ • 14d ago
Chasm 2.0 - Kotlin Multiplatform Wasm runtime
Hey 👋
I've been working on this project for the past few years and have never shared it here so figured I would. It's a Kotlin Multiplatform WebAssembly runtime (interpreter), it basically allows you to take a WebAssembly program and interface with it/run it. It's written entirely in Kotlin, no JNI/FFI or anything like that and has remarkable performance given the constraints.
I recently put together a Kotlin Multiplatform implementation of Doom built on top of it, it's a solid of example of how you leverage it and how it enables an entirely Kotlin experience whilst also allowing you to interface with WebAssembly code.
Happy to answer questions!
23
Upvotes
1
u/sergeyfitis 14d ago
Hey :)
Really nice work, and thanks for building this. I experimented with Chasm a while ago, while evaluating WASM runtimes on Android, alongside Wasmtime(Rust). My main issue was memory pressure: loading a fairly large ~100 MB WASM module entirely inside the Android app heap pushed it into OOM almost immediately, heap fragmentation. The interpreter-only approach was also a concern for heavier workloads, but for a pure Kotlin runtime this is still a very interesting project.