2 ms·
Has the call from C to Rust also zero overhead?
by madez 12y ago
Has the call from C to Rust also zero overhead?
- alexcrichton 12y agoIt does indeed! Due to Rust's lack of a garbage collector or runtime altogether, when C calls into Rust there is no overhead. In the example in the blog post [1] you can see that the Rust function has no extra syntactic burden, and the compiler also will not add any form of conversion one way or another. The C code then just emits a direct call to the symbol, so everything is totally free! [1]: http://blog.rust-lang.org/2015/04/24/Rust-Once-Run-Everywhere.html#c-talking-to-rust http://blog.rust-lang.org/2015/04/24/Rust-Once-Run-Everywher...