@@ -27,6 +27,9 @@ export interface PerformanceComparisonDataFromLog {
2727 */
2828 names : string [ ] ;
2929
30+ /** RA hash of the `i`th predicate event */
31+ raHashes : string [ ] ;
32+
3033 /** Number of milliseconds spent evaluating the `i`th predicate from the `names` array. */
3134 timeCosts : number [ ] ;
3235
@@ -56,38 +59,43 @@ export interface PerformanceComparisonDataFromLog {
5659}
5760
5861export class PerformanceOverviewScanner implements EvaluationLogScanner {
59- private readonly nameToIndex = new Map < string , number > ( ) ;
6062 private readonly data : PerformanceComparisonDataFromLog = {
6163 names : [ ] ,
64+ raHashes : [ ] ,
6265 timeCosts : [ ] ,
6366 tupleCosts : [ ] ,
6467 cacheHitIndices : [ ] ,
6568 sentinelEmptyIndices : [ ] ,
6669 pipelineSummaryList : [ ] ,
6770 evaluationCounts : [ ] ,
6871 iterationCounts : [ ] ,
72+ dependencyLists : [ ] ,
6973 } ;
74+ private readonly raToIndex = new Map < string , number > ( ) ;
7075
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 ) ;
7478 if ( index === undefined ) {
75- index = nameToIndex . size ;
76- nameToIndex . set ( name , index ) ;
79+ index = this . raToIndex . size ;
80+ this . raToIndex . set ( ra , index ) ;
7781 const {
7882 names,
83+ raHashes,
7984 timeCosts,
8085 tupleCosts,
8186 iterationCounts,
8287 evaluationCounts,
8388 pipelineSummaryList,
89+ dependencyLists,
8490 } = this . data ;
8591 names . push ( name ) ;
92+ raHashes . push ( ra ) ;
8693 timeCosts . push ( 0 ) ;
8794 tupleCosts . push ( 0 ) ;
8895 iterationCounts . push ( 0 ) ;
8996 evaluationCounts . push ( 0 ) ;
9097 pipelineSummaryList . push ( { } ) ;
98+ dependencyLists . push ( [ ] ) ;
9199 }
92100 return index ;
93101 }
@@ -97,7 +105,7 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
97105 }
98106
99107 onEvent ( event : SummaryEvent ) : void {
100- const { completionType, evaluationStrategy, predicateName } = event ;
108+ const { completionType, evaluationStrategy, predicateName, raHash } = event ;
101109 if ( completionType !== undefined && completionType !== "SUCCESS" ) {
102110 return ; // Skip any evaluation that wasn't successful
103111 }
@@ -111,22 +119,24 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
111119 case "CACHACA" : {
112120 // Record a cache hit, but only if the predicate has not been seen before.
113121 // 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+ ) ;
116126 }
117127 break ;
118128 }
119129 case "SENTINEL_EMPTY" : {
120130 this . data . sentinelEmptyIndices . push (
121- this . getPredicateIndex ( predicateName ) ,
131+ this . getPredicateIndex ( predicateName , raHash ) ,
122132 ) ;
123133 break ;
124134 }
125135 case "COMPUTE_RECURSIVE" :
126136 case "COMPUTE_SIMPLE" :
127137 case "NAMED_LOCAL" :
128138 case "IN_LAYER" : {
129- const index = this . getPredicateIndex ( predicateName ) ;
139+ const index = this . getPredicateIndex ( predicateName , raHash ) ;
130140 let totalTime = 0 ;
131141 let totalTuples = 0 ;
132142 if ( evaluationStrategy === "COMPUTE_SIMPLE" ) {
0 commit comments