Zig

The reason why we can often get away with using languages like Python or JavaScript to drive resource-intensive computations, is because under the hood somebody took years to perfect a C implementation of a key procedure and shared it with the world under a permissive license. - Maintain it With Zig / HN / Home

see also

Zig Interop Overhead Table with Metrics

These are rough per-function call latencies on modern desktop CPUs. Actual values vary based on OS, CPU, type conversion, and data size.

Language Interop Method Typical Workflow Overhead Level Approx. Call Latency*
Java JNI Zig shared lib loaded via System.loadLibrary() Low ~50–200 ns per native call
  JNA/JNR Reflection-based FFI Medium ~1–5 µs per call
  IPC (sockets, REST) Zig as separate process High ~100 µs – 1 ms per request
C++ C ABI wrappers extern "C" Low ~5–50 ns per call
  Direct C++ interop @cImport + C++ Medium ~50–200 ns (depends on ABI, exceptions)
Ruby C extension Zig lib loaded as native Ruby extension Low ~50–200 ns per call
  Ruby FFI (ffi gem) Zig C ABI lib via FFI Medium ~1–5 µs per call
Python CPython C API Zig compiled as Python module Low ~50–200 ns per call
  ctypes/cffi Zig C ABI lib loaded in Python Medium ~1–10 µs per call
General IPC Sockets/pipes/gRPC High ~100 µs – 1+ ms per round-trip
Written on October 18, 2021, Last update on April 16, 2025
lang zig c++ rust golang