[Media] BoltFFI: a high-performance Rust bindings generator (up to 1,000× vs UniFFI microbenchmarks)

378 points alihilal94 54 comments
[Media] BoltFFI: a high-performance Rust bindings generator (up to 1,000× vs UniFFI microbenchmarks)

Repo + benchmarks: https://github.com/boltffi/boltffi

We’ve been working on BoltFFI, a tool to generate bindings and package Rust code for iOS, Android, and the Web.
It is focused on keeping boundary overhead low where primitives are passed as values, structs-of-primitives by pointer, strings and collections use optimized encoding format.

The tool handles the artifact generation out of the box, producing an XCFramework for Apple platforms, and native outputs for Android and WASM (supporting multiple bundlers).

Swift, Kotlin, and TypeScript (WASM) are supported today. Python is next and other languages are in the backlog.

The Benchmarks and code are in the repo (vs UniFFI).
A few highlights:

  • echo_i32: <1 ns vs 1,416 ns → >1000×
  • counter_increment (1k calls): 1,083 ns vs 1,388,895 ns → 1,282×
  • generate_locations (10k structs): 62,542 ns vs 12,817,000 ns → 205×

Repo & Benchmarks: https://github.com/boltffi/boltffi