(id, memo)
| 863 | const byId = {}; |
| 864 | TRACE_SPANS.forEach((s) => (byId[s.id] = s)); |
| 865 | function depthOf(id, memo) { |
| 866 | if (!memo) memo = {}; |
| 867 | if (memo[id] != null) return memo[id]; |
| 868 | const s = byId[id]; |
| 869 | if (!s || s.parent == null) memo[id] = 0; |
| 870 | else memo[id] = depthOf(s.parent, memo) + 1; |
| 871 | return memo[id]; |
| 872 | } |
| 873 | const memo = {}; |
| 874 | const depths = {}; |
| 875 | TRACE_SPANS.forEach((s) => (depths[s.id] = depthOf(s.id, memo))); |