Moves data into the L1 cache before it is read, or "prefetches" it.
Declared in <absl/base/prefetch.h>
void
PrefetchToLocalCacheNta(void const* addr);
This function is identical to PrefetchToLocalCache() except that it has non-temporal locality: the fetched data should not be left in any of the cache tiers. This is useful for cases where the data is used only once / short term, for example, invoking a destructor on an object.
Incorrect or gratuitous use of this function can degrade performance. Use this function only when representative benchmarks show an improvement.
Example:
template <typename Iterator> void DestroyPointers(Iterator begin, Iterator end) { size_t distance = std::min(8U, bars.size());
int dist = 8; auto prefetch_it = begin; while (prefetch_it != end && --dist;) { absl::PrefetchToLocalCacheNta(*prefetch_it++); } while (prefetch_it != end) { delete *begin++; absl::PrefetchToLocalCacheNta(*prefetch_it++); } while (begin != end) { delete *begin++; } }
| Name | Description |
|---|---|
| addr | The address of the memory to prefetch. |