pub struct PolynomialArena { /* private fields */ }Expand description
Specialized handle for Polynomial and FFT data.
Optimized for cache-line alignment and massive vectors.
Implementations§
Source§impl PolynomialArena
impl PolynomialArena
Sourcepub fn alloc_fft_friendly(&self, size: usize) -> *mut u8
pub fn alloc_fft_friendly(&self, size: usize) -> *mut u8
Allocate polynomial data with 64-byte alignment for optimal FFT/NTT performance.
This alignment is critical for SIMD-accelerated operations:
- AVX-512: Requires 64-byte alignment
- AVX/AVX2: Benefits from 32-byte alignment (64 is a superset)
- Cache efficiency: Modern cache lines are 64 bytes
Sourcepub fn alloc_huge(&self, size: usize) -> *mut u8
pub fn alloc_huge(&self, size: usize) -> *mut u8
Allocate huge vectors with page alignment (4096 bytes).
Use this for vectors exceeding a few megabytes. Benefits:
- TLB efficiency: Reduces translation lookaside buffer misses
- Huge pages: May enable transparent huge page usage on Linux
- DMA compatibility: Required for some hardware accelerators
Sourcepub fn alloc(&self, size: usize, align: usize) -> *mut u8
pub fn alloc(&self, size: usize, align: usize) -> *mut u8
Allocate with custom alignment.
Use this when you have specific alignment requirements. Alignment must be a power of two.
Sourcepub unsafe fn alloc_slice<T>(&self, count: usize) -> *mut T
pub unsafe fn alloc_slice<T>(&self, count: usize) -> *mut T
Allocate a typed slice of elements with appropriate alignment.
This is a convenience method for allocating arrays of field elements or other ZK primitive types.
§Safety
The returned pointer must be properly aligned for type T. The caller is responsible for initializing the memory.
Auto Trait Implementations§
impl Freeze for PolynomialArena
impl RefUnwindSafe for PolynomialArena
impl Send for PolynomialArena
impl Sync for PolynomialArena
impl Unpin for PolynomialArena
impl UnsafeUnpin for PolynomialArena
impl UnwindSafe for PolynomialArena
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