Internals•Architecture

Rust SIMD & Purego Dynamic Architecture

How GoRoute achieves 0.86ms dispatch latency and < 5MB memory footprint using Pure Go, Purego dynamic linking, and vectorized Rust SIMD kernels.

1. Zero CGO Architecture

Traditional Go applications linking to C or Rust libraries rely on CGO. However, CGO introduces substantial runtime overhead: thread context switching, bloated binary sizes, and complicated cross-compilation across platforms.

GoRoute runs with CGO_ENABLED=0 everywhere. Dynamic loading of the optional Rust acceleration library (goroute-fast.so / .dylib / .dll) is executed at runtime via ebitengine/purego, which invokes dynamic library symbols using pure assembly stubs.

2. Vectorized SIMD Fast Path (crates/goroute-fast)

During high-concurrency coding agent sessions (e.g. Claude Code issuing multi-megabyte codebase snapshots), scanning tokens and parsing JSON ASTs creates memory garbage collection spikes in Go.

GoRoute offloads token scanning and byte-level payload filtering to a native Rust cdylib utilizing 256-bit AVX2 (x86_64) and 128-bit NEON (Apple Silicon / ARM64) vector instructions:

# Compiling the optional Rust acceleration cdylib
cd crates/goroute-fast && cargo build --release
# GoRoute automatically detects and links target/release/libgoroute_fast.* on startup

3. Empirical Memory Benchmark

MetricOmniRoute (Node)LiteLLM (Python)GoRoute (Go+Rust)
Idle Memory~380 MB~420 MB4.7 MB
Routing Latency18.4 ms24.1 ms0.86 ms
Cold Boot3,200 ms2,800 ms11 ms