diff --git a/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx b/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx index 9136553e4fe..51555600d4a 100644 --- a/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx +++ b/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx @@ -26,6 +26,8 @@ interface OptionalValue { } interface PredicateInfo extends OptionalValue { + evaluationCount: number; + iterationCount: number; pipelines: Record; } @@ -49,6 +51,8 @@ class ComparisonDataset { const index = nameToIndex.get(name); if (index == null) { return { + evaluationCount: 0, + iterationCount: 0, tuples: 0, absentReason: AbsentReason.NotSeen, pipelines: {}, @@ -64,6 +68,8 @@ class ComparisonDataset { } } return { + evaluationCount: data.evaluationCounts[index], + iterationCount: data.iterationCounts[index], tuples: tupleCost, absentReason, pipelines: data.pipelineSummaryList[index], @@ -187,6 +193,9 @@ interface PipelineStepProps { step: string; } +/** + * Row with details of a pipeline step, or one of the high-level stats appearing above the pipelines (evaluation/iteration counts). + */ function PipelineStep(props: PipelineStepProps) { let { before, after, step } = props; if (before != null && before < 0) { @@ -207,6 +216,46 @@ function PipelineStep(props: PipelineStepProps) { ); } +interface HighLevelStatsProps { + before: PredicateInfo; + after: PredicateInfo; +} + +function HighLevelStats(props: HighLevelStatsProps) { + const { before, after } = props; + const hasBefore = before.absentReason !== AbsentReason.NotSeen; + const hasAfter = after.absentReason !== AbsentReason.NotSeen; + const showEvaluationCount = + before.evaluationCount > 1 || after.evaluationCount > 1; + return ( + <> + + + {hasBefore ? "Before" : ""} + {hasAfter ? "After" : ""} + {hasBefore && hasAfter ? "Delta" : ""} + Stats + + {showEvaluationCount && ( + + )} + + + ); +} + type TRow = { name: string; before: PredicateInfo; @@ -378,6 +427,7 @@ export function ComparePerformance(_: Record) { {expandedPredicates.has(row.name) && ( <> + {collatePipelines( row.before.pipelines, row.after.pipelines,