MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / prefetch_node

Method prefetch_node

nodedb-graph/src/csr/memory.rs:58–70  ·  view source on GitHub ↗
(&self, node_id: u32)

Source from the content-addressed store, hash-verified

56 /// reaches them on the next iteration.
57 #[inline]
58 pub fn prefetch_node(&self, node_id: u32) {
59 let idx = node_id as usize;
60 if idx + 1 < self.out_offsets.len() {
61 // SAFETY: We're just hinting the CPU to load this address.
62 // The offset is within bounds (checked above). This is a
63 // performance hint, not a correctness requirement.
64 #[cfg(target_arch = "x86_64")]
65 unsafe {
66 let ptr = self.out_offsets.as_ptr().add(idx) as *const u8;
67 std::arch::x86_64::_mm_prefetch(ptr as *const i8, std::arch::x86_64::_MM_HINT_T0);
68 }
69 }
70 }
71
72 /// Prefetch a batch of nodes (called during BFS frontier expansion).
73 pub fn prefetch_batch(&self, node_ids: &[u32]) {

Callers 2

traverse_bfsMethod · 0.80
prefetch_batchMethod · 0.80

Calls 3

lenMethod · 0.45
addMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected