uniffi-rs
uniffi-rs copied to clipboard
Use C structs/tagged unions for Records/Enums
Currently these types are always serialized into a RustBuffer which has been long believed to be inefficient (Issue 244, ADR-002). We should explore passing these as repr(C) structs and tagged unions to avoid the overhead of serialization and allocating a buffer.
These could either be passed across the FFI as a pointer/reference or as the struct directly. Some of the recent changes could help here, for example we now have both FfiType::Struct and FfiType::Reference.
Any change here should be accompanied by a benchmark that measures performance changes.