Skip to main content

cpu_ref

Function cpu_ref 

Source
pub fn cpu_ref(
    parent: &[u32],
    target: u32,
    max_depth: u32,
    scratch: &mut Vec<u32>,
) -> u32
Expand description

CPU reference: walks parent pointers up to max_depth, writing the materialized path into scratch and returning its length. Early-terminates when a node’s parent points at itself (root convention).

§Performance

Callers doing many reconstructions (e.g. one per node in a deep call graph) should reuse one scratch vector across calls to avoid an allocation per walk.