Skip to content

Commit 70bd215

Browse files
committed
Quick and dirty name truncation
1 parent 00e28e9 commit 70bd215

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,25 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
8080
iterationCounts: [],
8181
};
8282

83+
private truncate(name: string) {
84+
name = name.replace(/#[0-9a-f]{8}(?![0-9a-f])/, "");
85+
const limit = 300;
86+
if (name.length > limit) {
87+
const colon = name.lastIndexOf("::");
88+
if (colon === -1) {
89+
return `${name.substring(0, limit)}...`;
90+
} else {
91+
const suffix = name.substring(colon);
92+
return `(...)${suffix}`;
93+
}
94+
} else {
95+
return name;
96+
}
97+
}
98+
8399
private getPredicateIndex(name: string): number {
84100
const { nameToIndex } = this;
101+
name = this.truncate(name);
85102
let index = nameToIndex.get(name);
86103
if (index === undefined) {
87104
index = nameToIndex.size;

0 commit comments

Comments
 (0)