#[repr(align(32))]pub struct SimdOps;Expand description
SIMD-accelerated operations optimized for HFT market data processing
Provides safe, portable SIMD implementations of common numerical operations
used in high-frequency trading applications. All operations use the wide
crate for guaranteed safety and cross-platform compatibility.
§Design Principles
- Safety first: Zero unsafe code, guaranteed memory safety
- Portability: Works across x86_64, ARM, and other architectures
- Performance: 2-4x speedup through SIMD vectorization
- Simplicity: Clean API that abstracts SIMD complexity
§Cache Alignment
32-byte alignment ensures optimal AVX/AVX2 performance and prevents cache line splits that could degrade SIMD operation efficiency.
Implementations§
Source§impl SimdOps
impl SimdOps
Sourcepub fn min_f64(values: &[f64]) -> f64
pub fn min_f64(values: &[f64]) -> f64
Apply SIMD-accelerated min to an array of f64 values Uses safe portable SIMD operations
Sourcepub fn max_f64(values: &[f64]) -> f64
pub fn max_f64(values: &[f64]) -> f64
Apply SIMD-accelerated max to an array of f64 values Uses safe portable SIMD operations
Sourcepub fn sum_f64(values: &[f64]) -> f64
pub fn sum_f64(values: &[f64]) -> f64
Apply SIMD-accelerated sum to an array of f64 values Uses safe portable SIMD operations
Sourcepub fn avg_f64(values: &[f64]) -> f64
pub fn avg_f64(values: &[f64]) -> f64
Apply SIMD-accelerated average to an array of f64 values Uses safe portable SIMD operations
Sourcepub fn weighted_avg_f64(values: &[f64], weights: &[f64]) -> f64
pub fn weighted_avg_f64(values: &[f64], weights: &[f64]) -> f64
Apply SIMD-accelerated weighted average to arrays of values and weights Uses safe portable SIMD operations
Sourcepub fn convert_to_f64<T: Into<f64> + Copy>(values: &[T]) -> Vec<f64>
pub fn convert_to_f64<T: Into<f64> + Copy>(values: &[T]) -> Vec<f64>
Convert an array of decimal prices to f64 for SIMD operations
Sourcepub const fn avx2_supported() -> bool
pub const fn avx2_supported() -> bool
Check if AVX2 is supported at runtime Kept for backward compatibility but no longer needed with portable SIMD
Sourcepub fn min_f64_aligned(values: &[f64]) -> f64
pub fn min_f64_aligned(values: &[f64]) -> f64
Apply SIMD-accelerated min using simd_aligned containers for optimal memory alignment This version ensures data is properly aligned for SIMD operations and uses thread-local buffers
Sourcepub fn max_f64_aligned(values: &[f64]) -> f64
pub fn max_f64_aligned(values: &[f64]) -> f64
Apply SIMD-accelerated max using simd_aligned containers for optimal memory alignment This version uses thread-local buffers to avoid repeated allocations
Sourcepub fn sum_f64_aligned(values: &[f64]) -> f64
pub fn sum_f64_aligned(values: &[f64]) -> f64
Apply SIMD-accelerated sum using simd_aligned containers This version uses thread-local buffers to avoid repeated allocations