Expand description
SVM-optimized memory operations.
The Solana BPF VM provides syscall-level memory operations that are faster than Rust’s default libc implementations because they are JIT-compiled intrinsics in the VM. No framework exposes these at the substrate level.
On BPF, these dispatch to sol_memcpy_, sol_memmove_, sol_memcmp_,
and sol_memset_. Off-chain, they fall back to standard library
implementations.
Use these instead of core::ptr::copy_nonoverlapping, ptr::write_bytes,
etc. for best performance on the SVM.
Functions§
- bytes_
eq - Compare two byte slices for equality using SVM-optimized memcmp.
- copy_
bytes - Copy bytes from one slice to another (no overlap).
- memcmp⚠
- Compare
nbytes between two memory regions. - memcpy⚠
- Copy
nbytes fromsrctodst. - memmove⚠
- Copy
nbytes fromsrctodst, handling overlapping regions. - memset⚠
- Fill
nbytes starting atdstwithbyte. - zero_
account_ data - Zero-fill account data using SVM-optimized memset.
- zero_
fill - Zero-fill a mutable byte slice using the SVM-optimized memset.