Skip to content

Compare performance: Detect 'shadowed' cache hits and a few other fixes #4018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 30, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Destructure event object
  • Loading branch information
asgerf committed Apr 22, 2025
commit 55c808e1c2b71994ea78ab18601cf2f13231fb1b
20 changes: 8 additions & 12 deletions extensions/ql-vscode/src/log-insights/performance-comparison.ts
Original file line number Diff line number Diff line change
@@ -97,14 +97,12 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
}

onEvent(event: SummaryEvent): void {
if (
event.completionType !== undefined &&
event.completionType !== "SUCCESS"
) {
const { completionType, evaluationStrategy, predicateName } = event;
if (completionType !== undefined && completionType !== "SUCCESS") {
return; // Skip any evaluation that wasn't successful
}

switch (event.evaluationStrategy) {
switch (evaluationStrategy) {
case "EXTENSIONAL":
case "COMPUTED_EXTENSIONAL": {
break;
@@ -113,26 +111,24 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
case "CACHACA": {
// Record a cache hit, but only if the predicate has not been seen before.
// We're mainly interested in the reuse of caches from an earlier query run as they can distort comparisons.
if (!this.nameToIndex.has(event.predicateName)) {
this.data.cacheHitIndices.push(
this.getPredicateIndex(event.predicateName),
);
if (!this.nameToIndex.has(predicateName)) {
this.data.cacheHitIndices.push(this.getPredicateIndex(predicateName));
}
break;
}
case "SENTINEL_EMPTY": {
this.data.sentinelEmptyIndices.push(
this.getPredicateIndex(event.predicateName),
this.getPredicateIndex(predicateName),
);
break;
}
case "COMPUTE_RECURSIVE":
case "COMPUTE_SIMPLE":
case "IN_LAYER": {
const index = this.getPredicateIndex(event.predicateName);
const index = this.getPredicateIndex(predicateName);
let totalTime = 0;
let totalTuples = 0;
if (event.evaluationStrategy !== "IN_LAYER") {
if (evaluationStrategy !== "IN_LAYER") {
totalTime += event.millis;
} else {
// IN_LAYER events do no record of their total time.