Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
"description": "command to open your preferred file browser. Use the ${traceDir} substitution variable",
"order": 8
},
"tsperf.tracer.slowTypeThresholdMs": {
"type": "number",
"default": 100,
"description": "Types taking longer than this many milliseconds will be highlighted as slow/complex",
"order": 9
},
"tsperf.tracer.traceTimeThresholds": {
"type": "object",
"properties": {
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ async function runDiagnostics(collection: vscode.DiagnosticCollection, filePath:
const duration = durations.reduce((a, b) => a + b, 0) / durations.length
const proportionalTime = duration / baseline

if (proportionalTime > 1) {
const config = vscode.workspace.getConfiguration('tsperf.tracer')
const slowThreshold = config.get<number>('slowTypeThresholdMs', 100)

if (proportionalTime > 1 || duration > slowThreshold) {
const comparisonPercentage = Math.round(proportionalTime * 100) - 100
const sign = comparisonPercentage > 1 ? '+' : ''
const logLevel = proportionalTime > 2
Expand Down