| Crates.io | bridge-core |
| lib.rs | bridge-core |
| version | 0.1.0 |
| created_at | 2025-12-28 10:28:17.032381+00 |
| updated_at | 2025-12-28 10:28:17.032381+00 |
| description | Core utilities for BridgeRust engines |
| homepage | |
| repository | https://github.com/bridgerust/bridgerust |
| max_upload_size | |
| id | 2008566 |
| size | 23,350 |
Shared utilities for BridgeRust engines.
The simd module provides high-performance vector operations with automatic SIMD acceleration when available.
dot_product(a, b) - Computes the dot product of two vectorsl2_distance(a, b) - Computes the Euclidean distance between two vectorscosine_similarity(a, b) - Computes cosine similarity (range: [-1, 1])normalize_in_place(v) - Normalizes a vector to unit length in-placel2_norm(v) - Computes the L2 norm (magnitude) of a vectorSIMD optimizations are enabled via compile-time flags:
For x86_64 with AVX2:
RUSTFLAGS="-C target-feature=+avx2" cargo build --release
For x86_64 with SSE4.1:
RUSTFLAGS="-C target-feature=+sse4.1" cargo build --release
For ARM64 with NEON:
RUSTFLAGS="-C target-feature=+neon" cargo build --release
The functions automatically fall back to scalar implementations when SIMD is not available, ensuring compatibility across all platforms.
Expected speedups:
Run benchmarks to measure actual performance on your hardware:
cd benchmarks/embex
cargo bench --bench simd_bench