Skip to content

Commit f09210b

Browse files
committed
Only record cache hits prior to first evaluation
1 parent 44d33d6 commit f09210b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

extensions/ql-vscode/src/log-insights/performance-comparison.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
115115
}
116116
case "CACHE_HIT":
117117
case "CACHACA": {
118-
this.data.cacheHitIndices.push(
119-
this.getPredicateIndex(event.predicateName),
120-
);
118+
// Record a cache hit, but only if the predicate has not been seen before.
119+
// We're mainly interested in the reuse of caches from an earlier query run as they can distort comparisons.
120+
if (!this.nameToIndex.has(event.predicateName)) {
121+
this.data.cacheHitIndices.push(
122+
this.getPredicateIndex(event.predicateName),
123+
);
124+
}
121125
break;
122126
}
123127
case "SENTINEL_EMPTY": {

0 commit comments

Comments
 (0)