Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You'd obviously prefer calling into things made in your own language than some other. But, from any other language you'd much prefer a C interface over having to explicitly describe which registers & stack slots to put things in and read from.


I did this once trying to mitigate Go's FFI performance cost. It wasn't great but it wasn't awful either. If I had to do it again I'd generate the assembly trampolines.



There are a couple solid summaries in that thread based on my experience going through that exercise - thanks for the link

In case anybody wants to go down the rabbit hole of shit you should definitely not use in production (but we did anyway), this was my starting point: https://words.filippo.io/rustgo/

I did not, however, `no_std` or avoid heap allocation on the Rust side. Everything worked great, including running a multithreaded tokio runtime.

Still do not recommend in prod ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: