Skip to content

Commit 55c808e

Browse files
committed
Destructure event object
1 parent 6e59d40 commit 55c808e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,12 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
9797
}
9898

9999
onEvent(event: SummaryEvent): void {
100-
if (
101-
event.completionType !== undefined &&
102-
event.completionType !== "SUCCESS"
103-
) {
100+
const { completionType, evaluationStrategy, predicateName } = event;
101+
if (completionType !== undefined && completionType !== "SUCCESS") {
104102
return; // Skip any evaluation that wasn't successful
105103
}
106104

107-
switch (event.evaluationStrategy) {
105+
switch (evaluationStrategy) {
108106
case "EXTENSIONAL":
109107
case "COMPUTED_EXTENSIONAL": {
110108
break;
@@ -113,26 +111,24 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
113111
case "CACHACA": {
114112
// Record a cache hit, but only if the predicate has not been seen before.
115113
// We're mainly interested in the reuse of caches from an earlier query run as they can distort comparisons.
116-
if (!this.nameToIndex.has(event.predicateName)) {
117-
this.data.cacheHitIndices.push(
118-
this.getPredicateIndex(event.predicateName),
119-
);
114+
if (!this.nameToIndex.has(predicateName)) {
115+
this.data.cacheHitIndices.push(this.getPredicateIndex(predicateName));
120116
}
121117
break;
122118
}
123119
case "SENTINEL_EMPTY": {
124120
this.data.sentinelEmptyIndices.push(
125-
this.getPredicateIndex(event.predicateName),
121+
this.getPredicateIndex(predicateName),
126122
);
127123
break;
128124
}
129125
case "COMPUTE_RECURSIVE":
130126
case "COMPUTE_SIMPLE":
131127
case "IN_LAYER": {
132-
const index = this.getPredicateIndex(event.predicateName);
128+
const index = this.getPredicateIndex(predicateName);
133129
let totalTime = 0;
134130
let totalTuples = 0;
135-
if (event.evaluationStrategy !== "IN_LAYER") {
131+
if (evaluationStrategy !== "IN_LAYER") {
136132
totalTime += event.millis;
137133
} else {
138134
// IN_LAYER events do no record of their total time.

0 commit comments

Comments
 (0)