Noah Muth

Full Stack Developer


Are Ports Fast Enough? – Benchmarking Language Interop with Elixir

Some background: I’m exploring the possibility of using Elixir to drive a game engine. Elixir is a great candidate for a scripting language because of its user-friendly nature, but it’s not fast enough to power a rendering engine by itself. For that, you need a native language like C, Rust, or Go, with some means of communication between the Elixir gameplay logic and the native rendering code.

Ports are one of the main ways that Elixir can communicate with programs written in other languages. When you use a port, the VM spawns another OS process and communicates with it over stdin and stdout. Since this is the simplest way to do IPC between Elixir and other languages, I did some very informal benchmarks to find out if it’s fast enough for my game engine.

TL;DR: ports are definitely fast enough. You can check out the source code for the benchmarks here.

Methodology

For each of the...

Continue reading →