| Java now has FFM, that is far better and simpler than JNI, FWIW. and chatgpt says Language/API | Call Overhead (no-op C) | Notes Go (cgo) | ~40–60 ns | Stack switch + thread pinning Java FFM | ~50 ns (downcall) | Similar to JNI, can be ~30 ns with isTrivial() Java FFM (leaf) | ~30–40 ns | Optimized (isTrivial=true) JNI | ~50–60 ns | Slightly slower than FFM Rust (unsafe) | ~5–20 ns | Near-zero overhead C# (P/Invoke) | ~20–50 ns | Depends on marshaling Python (cffi) | 1000–10000 ns | Orders of magnitude slower | |