MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / debug_size_and_depth

Method debug_size_and_depth

src/expr/src/relation.rs:1958–1968  ·  view source on GitHub ↗

Computes the size (total number of nodes) and maximum depth of a MirRelationExpr for debug printing purposes.

(&self)

Source from the content-addressed store, hash-verified

1956 /// Computes the size (total number of nodes) and maximum depth of a MirRelationExpr for
1957 /// debug printing purposes.
1958 pub fn debug_size_and_depth(&self) -> (usize, usize) {
1959 let mut size = 0;
1960 let mut max_depth = 0;
1961 let mut todo = vec![(self, 1)];
1962 while let Some((expr, depth)) = todo.pop() {
1963 size += 1;
1964 max_depth = max(max_depth, depth);
1965 todo.extend(expr.children().map(|c| (c, depth + 1)));
1966 }
1967 (size, max_depth)
1968 }
1969
1970 /// The MirRelationExpr is considered potentially expensive if and only if
1971 /// at least one of the following conditions is true:

Callers

nothing calls this directly

Calls 4

childrenMethod · 0.65
popMethod · 0.45
extendMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected