Skip to main content

prefetch_read

Function prefetch_read 

Source
pub unsafe fn prefetch_read<T>(ptr: *const T)
Expand description

prefetches memory for read access into L1 cache.

use this for data that will be read soon and accessed multiple times.

ยงsafety

the pointer should be derived from a valid allocation or object. On x86_64 the prefetch instruction is only a cache hint and generally does not fault, but callers should still avoid fabricating invalid provenance.