From 2b1eb20c642fcf80430762bea154bdb88ba70477 Mon Sep 17 00:00:00 2001 From: Asger F Date: Wed, 13 Nov 2024 11:50:42 +0100 Subject: [PATCH] Show evaluation and iteration counts in table --- .../ComparePerformance.tsx | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx b/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx index dafa82aef58..a5ca2e76e2a 100644 --- a/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx +++ b/extensions/ql-vscode/src/view/compare-performance/ComparePerformance.tsx @@ -25,6 +25,8 @@ interface OptionalValue { } interface PredicateInfo extends OptionalValue { + evaluationCount: number; + iterationCount: number; pipelines: Record; } @@ -48,6 +50,8 @@ class ComparisonDataset { const index = nameToIndex.get(name); if (index == null) { return { + evaluationCount: 0, + iterationCount: 0, tuples: 0, absentReason: AbsentReason.NotSeen, pipelines: {}, @@ -63,6 +67,8 @@ class ComparisonDataset { } } return { + evaluationCount: data.evaluationCounts[index], + iterationCount: data.iterationCounts[index], tuples: tupleCost, absentReason, pipelines: data.pipelineSummaryList[index], @@ -184,6 +190,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) { @@ -204,6 +213,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 && ( + + )} + + + ); +} + function Chevron({ expanded }: { expanded: boolean }) { return ; } @@ -350,6 +399,7 @@ export function ComparePerformance(_: Record) { {expandedPredicates.has(row.name) && ( <> + {collatePipelines( row.before.pipelines, row.after.pipelines,