SimSIMD
SIMD-accelerated distance, dot-product, and similarity kernels for high-dimensional vectors.
Repository Health
Technical Analysis
SimSIMD is a portable, mixed-precision math and retrieval library providing thousands of hand-tuned SIMD kernels for distances, dot products, and vector similarity across x86, Arm, RISC-V, LoongArch, Power, and WebAssembly. It powers fast vector search and numerical workloads by dispatching to the best available CPU instructions at runtime.
Unlike many libraries that return results in the same narrow type as the input, SimSIMD promotes to wider accumulators (Int8 to Int32, Float16 to Float32, and so on) to avoid quiet overflow, delivering both speed and numerical stability. It exposes bindings for Rust, Python, C, C++, Swift, JavaScript, and Go.
What You Get
- Thousands of SIMD kernels for distances, dot products, and similarity metrics
- Support for many numeric types from low-bit integers and floats to complex numbers
- Runtime CPU dispatch across x86, Arm, RISC-V, LoongArch, Power, and WebAssembly
- Wide-accumulator arithmetic that avoids overflow for stable results
Common Use Cases
- Accelerating nearest-neighbor and vector similarity search
- Computing embeddings distances in retrieval and RAG pipelines
- Speeding up numerical and linear-algebra workloads on the CPU
Under The Hood
Architecture - The core kernels live in C/assembly under c/ and include/, organized by capability and dispatched at runtime based on detected CPU features. The Rust binding under rust/ wraps this core through build.rs (compiling the C sources and FFI) and layers ergonomic modules: spatial.rs (distances), vector.rs, matrix.rs, sparse.rs, reduce.rs, probability.rs, geospatial.rs, curved.rs, and capabilities.rs for feature introspection, with types.rs/cast.rs handling the wide numeric-type matrix.
Tech Stack - A C core (with hand-written SIMD/assembly) exposed via FFI, wrapped for Rust (edition 2021, no_std-capable) built with Cargo and a custom build.rs. The same core feeds Python, Swift, JavaScript, Go, and C++ bindings via cmake/gyp/setuptools configs in the repo.
Code Quality - The project is mature and rigorously validated, with edge-case coverage for saturation, casting, and rounding checked against extended-precision baselines, plus a test/ suite and CI probes. The multi-language surface is kept consistent through generated bindings and a shared VERSION.
API Design - From Rust the API is slice-oriented and ergonomic (call a distance function over two typed slices), hiding the runtime dispatch complexity. Some learning is required to pick the right metric and numeric type, but documentation and per-binding READMEs keep common paths simple.