#[repr(align(32))]pub struct AlignedBuffer32<T, const N: usize>{ /* private fields */ }Expand description
32-byte aligned buffer optimized for AVX/AVX2 SIMD operations
Provides guaranteed memory alignment for optimal SIMD performance in HFT calculations. The 32-byte alignment matches AVX register width for efficient vectorized operations.
§Performance Benefits
- SIMD efficiency: Aligned loads/stores avoid performance penalties
- Cache optimization: Reduces cache line splits and false sharing
- Compiler hints: Enables better auto-vectorization
- Zero-cost abstraction: Alignment overhead eliminated at compile time
§Usage Patterns
// Price calculations with SIMD optimization
let mut prices = AlignedBuffer32::<f64, 256>::new();
let prices_slice = prices.as_mut_slice();
// ... fill with market data ...
let vwap = calculate_vwap_vectorized(prices_slice, volumes);Implementations§
Source§impl<T, const N: usize> AlignedBuffer32<T, N>
impl<T, const N: usize> AlignedBuffer32<T, N>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new 32-byte aligned buffer with all elements initialized to default
Sourcepub const fn with_value(value: T) -> Self
pub const fn with_value(value: T) -> Self
Create a new 32-byte aligned buffer with all elements initialized to the given value
Sourcepub const fn as_mut_slice(&mut self) -> &mut [T]
pub const fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice view of the buffer data
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> Freeze for AlignedBuffer32<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for AlignedBuffer32<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for AlignedBuffer32<T, N>where
T: Send,
impl<T, const N: usize> Sync for AlignedBuffer32<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for AlignedBuffer32<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for AlignedBuffer32<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more