Meilisearch

Unaligned vector memory hinders SIMD distance calculation performance

info
performanceUpdated Feb 19, 2026(via Exa)
Technologies:
How to detect:

Embeddings wrapped in UnalignedVector in composite.rs can prevent SIMD (SSE/AVX) optimizations during distance calculations (dot product, cosine similarity). Unaligned memory access forces slower non-aligned loads, with overhead accumulating over millions of comparisons in large vector indexes.

Recommended action:

Ensure 32-byte memory alignment for embeddings to enable efficient SIMD vectorization. Review the embedder implementation in crates/milli/src/vector/embedder/composite.rs and verify that embeddings use aligned memory allocations. Ensure distance calculation functions (rroy::Distance and hannoy::Distance traits) are inlined across crate boundaries in hot loops.