@@ -27,6 +27,9 @@ export interface PerformanceComparisonDataFromLog {
27
27
*/
28
28
names : string [ ] ;
29
29
30
+ /** RA hash of the `i`th predicate event */
31
+ raHashes : string [ ] ;
32
+
30
33
/** Number of milliseconds spent evaluating the `i`th predicate from the `names` array. */
31
34
timeCosts : number [ ] ;
32
35
@@ -56,38 +59,43 @@ export interface PerformanceComparisonDataFromLog {
56
59
}
57
60
58
61
export class PerformanceOverviewScanner implements EvaluationLogScanner {
59
- private readonly nameToIndex = new Map < string , number > ( ) ;
60
62
private readonly data : PerformanceComparisonDataFromLog = {
61
63
names : [ ] ,
64
+ raHashes : [ ] ,
62
65
timeCosts : [ ] ,
63
66
tupleCosts : [ ] ,
64
67
cacheHitIndices : [ ] ,
65
68
sentinelEmptyIndices : [ ] ,
66
69
pipelineSummaryList : [ ] ,
67
70
evaluationCounts : [ ] ,
68
71
iterationCounts : [ ] ,
72
+ dependencyLists : [ ] ,
69
73
} ;
74
+ private readonly raToIndex = new Map < string , number > ( ) ;
70
75
71
- private getPredicateIndex ( name : string ) : number {
72
- const { nameToIndex } = this ;
73
- let index = nameToIndex . get ( name ) ;
76
+ private getPredicateIndex ( name : string , ra : string ) : number {
77
+ let index = this . raToIndex . get ( ra ) ;
74
78
if ( index === undefined ) {
75
- index = nameToIndex . size ;
76
- nameToIndex . set ( name , index ) ;
79
+ index = this . raToIndex . size ;
80
+ this . raToIndex . set ( ra , index ) ;
77
81
const {
78
82
names,
83
+ raHashes,
79
84
timeCosts,
80
85
tupleCosts,
81
86
iterationCounts,
82
87
evaluationCounts,
83
88
pipelineSummaryList,
89
+ dependencyLists,
84
90
} = this . data ;
85
91
names . push ( name ) ;
92
+ raHashes . push ( ra ) ;
86
93
timeCosts . push ( 0 ) ;
87
94
tupleCosts . push ( 0 ) ;
88
95
iterationCounts . push ( 0 ) ;
89
96
evaluationCounts . push ( 0 ) ;
90
97
pipelineSummaryList . push ( { } ) ;
98
+ dependencyLists . push ( [ ] ) ;
91
99
}
92
100
return index ;
93
101
}
@@ -97,7 +105,7 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
97
105
}
98
106
99
107
onEvent ( event : SummaryEvent ) : void {
100
- const { completionType, evaluationStrategy, predicateName } = event ;
108
+ const { completionType, evaluationStrategy, predicateName, raHash } = event ;
101
109
if ( completionType !== undefined && completionType !== "SUCCESS" ) {
102
110
return ; // Skip any evaluation that wasn't successful
103
111
}
@@ -111,22 +119,24 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
111
119
case "CACHACA" : {
112
120
// Record a cache hit, but only if the predicate has not been seen before.
113
121
// We're mainly interested in the reuse of caches from an earlier query run as they can distort comparisons.
114
- if ( ! this . nameToIndex . has ( predicateName ) ) {
115
- this . data . cacheHitIndices . push ( this . getPredicateIndex ( predicateName ) ) ;
122
+ if ( ! this . raToIndex . has ( raHash ) ) {
123
+ this . data . cacheHitIndices . push (
124
+ this . getPredicateIndex ( predicateName , raHash ) ,
125
+ ) ;
116
126
}
117
127
break ;
118
128
}
119
129
case "SENTINEL_EMPTY" : {
120
130
this . data . sentinelEmptyIndices . push (
121
- this . getPredicateIndex ( predicateName ) ,
131
+ this . getPredicateIndex ( predicateName , raHash ) ,
122
132
) ;
123
133
break ;
124
134
}
125
135
case "COMPUTE_RECURSIVE" :
126
136
case "COMPUTE_SIMPLE" :
127
137
case "NAMED_LOCAL" :
128
138
case "IN_LAYER" : {
129
- const index = this . getPredicateIndex ( predicateName ) ;
139
+ const index = this . getPredicateIndex ( predicateName , raHash ) ;
130
140
let totalTime = 0 ;
131
141
let totalTuples = 0 ;
132
142
if ( evaluationStrategy === "COMPUTE_SIMPLE" ) {
0 commit comments