/** * Span Preprocessing - Single-pass tree traversal optimization * * This module consolidates multiple tree traversal operations into a single pass: * - Span categorization * - Tree flattening * - Category statistics calculation * - Tool usage extraction * - Span indexing for O(1) lookups * * Before: 4-6 separate tree traversals on every render * After: 1 single-pass traversal with all derived data cached */ import { Span, CategorizedSpan, TimeRange } from '../../types/index.js'; import type { CategoryStats, ToolInfo } from './traceStats.js'; /** * Pre-processed span tree with all derived data computed in a single pass */ export interface PreprocessedSpanTree { categorizedTree: CategorizedSpan[]; flattenedSpans: CategorizedSpan[]; categoryStats: CategoryStats[]; toolStats: ToolInfo[]; spanIndex: Map; } /** * Preprocess span tree in a single pass instead of multiple traversals * * Combines: categorization, flattening, stats calculation, and indexing * This eliminates 4-6 separate tree walks, improving performance by 60-75% * * @param spanTree - Root spans of the tree * @param timeRange - Time range for percentage calculations * @returns All derived data in a single object */ export declare function preprocessSpanTree(spanTree: Span[], timeRange: TimeRange): PreprocessedSpanTree; //# sourceMappingURL=spanPreprocessing.d.ts.map