Besides shared memory via mmap, what is the fastest way for GoLang / RustLang to do interop ?
I am wondering if there is a solution besides:
- GoLang <-> shared memory <-> RustLang
- GoLang <-> tcp <-> RustLang
- GoLang <-> udp <-> RustLang
I just need a way to exchange some [u8]'s.
FFI is out of the question, since there must be two processes, I suppose?
Yeah, it's two separate processes.
We're dealing with a system that has external facing protocols: http, https, websockets, webrtc, and possibly more in the future.
GoLang has very nice libraries for all of these, and, as far as I can tell, has compile time of O(1).
RustLang compile times often increase quite a bit with crates.
I am trying to use GoLang to face all the external protocols, pass msg to Rust, get msg back from Rust, and send msg back out to the internet.
mmap seems error prone
tcp/udp for two processes on the same machine seem a bit silly
I am wondering if there is something else.
The main other option would be an unix pipe.
Is one the subprocess of the other? If so using stdin/stdout would likely be reasonably fast.
If not using named pipes or a UNIX domain socket should work fine.
(Note that stdin/stdout is just a type of unix pipe.)
Sure, but without the need to set anything up and it works on Windows out-of-the-box as well.
Linux only is fine. By 'unix pipes' both of you mean
mkfifo right? I'm reading the man page and not seeing where I specify a buffer size.
You can change the buffer size via
fcntl, see pipe(7) — Linux manual pages
There are several ways to create a unix pipe, and
mkfifo is one of them.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.