Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/// @ts-check/**
* Chat performance benchmark.
*
* Uses the real copilot extension with IS_SCENARIO_AUTOMATION=1 and a local
* mock LLM server. Measures the full stack: prompt building, context
* gathering, tool resolution, rendering, GC, and layout overhead.
*
* Usage:
* npm run perf:chat # all scenarios vs 1.115.0
* npm run perf:chat -- --runs 10 # 10 runs per scenario
* npm run perf:chat -- --scenario text-only # single scenario
* npm run perf:chat -- --no-baseline # skip baseline comparison
* npm run perf:chat -- --build 1.110.0 --baseline-build 1.115.0
* npm run perf:chat -- --resume .chat-simulation-data/2026-04-14/results.json --runs 3
*/const path =require('path');const fs =require('fs');const{ROOT,DATA_DIR,METRIC_DEFS, loadConfig,
resolveBuild, isVersionString, buildEnv, buildArgs, prepareRunDir,
robustStats, welchTTest, summarize, markDuration, launchVSCode,
getNextExtHostInspectPort connectToExtHostInspector getRepoRoot
getUserTurns getScenarioIds
registerPerfScenarios getScenarioDescription
args process
opts
i i args i
argsi
opts argsi
opts
optsargsi
opts argsi
opts argsi
opts argsi
opts
opts
opts argsi
opts argsi
opts
kv argsi
eq kv
eq process
key kv eq
raw kveq
val raw raw raw raw raw
flag argsi
flag optskey val
flag optskey val
optskey val
opts
opts
opts
opts
opts opts opts opts
opts
process
opts
opts
knownIds
unknown opts knownIdss
unknown
process
opts
electronPath
electronPath
mode
product path
platform process
arch process
destDir path
execSync
e
electronPath
platform
electronPath pathdestDir product
platform
electronPath pathdestDir product
electronPath pathdestDir
fselectronPath
process
overridesPath path
fsoverridesPath
appDir
platform
appDir pathdestDir
appDir pathdestDir
packagedProductPath pathappDir
fspackagedProductPath
packagedProduct fspackagedProductPath
overrides fsoverridesPath
merged packagedProduct overrides
fspackagedProductPath merged
electronPath
raw
raw
num raw
num
num
raw optsmetric
raw
raw
opts
threshold
absoluteDelta threshold
change threshold
takeHeapSnapshots runOptsheapSnapshots
userDataDir extDir logsDir runIndex mockServer settingsOverrides
isDevBuild electronPath electronPath
buildLabel
isDevBuild
vscodeTestMatch electronPath
vscodeTestMatch
buildLabel vscodeTestMatch
electronPath
buildLabel
buildLabel pathelectronPath
appRoot isDevBuild electronPath
isDevBuild appRoot
verbose
runDiagDir pathrunDir runIndex
fsrunDiagDir
tracePath pathrunDiagDir
extHostInspectPort
vscode
electronPath
userDataDir extDir logsDir isDevBuild extHostInspectPort tracePath appRoot runOptsgcObjectStats
mockServer isDevBuild
verbose
activeVSCode vscode
vscode
extHostInspector
extHostHeapBefore
partialMetrics
submitTime
firstResponseTime
responseCompleteTime
renderCompleteTime
cdp
cdp
heapBefore cdp
metricsBefore cdp
chatShortcut process
chatShortcut
chatEditorSel
selector
rect el
rect rect
chatEditorSel
sel
el sel
el r
reqsBefore mockServer
mockServerreqsBefore
verbose
extHostInspector extHostInspectPort verbose
extHostInspector
extHostInspector
extHostInspector
extHostHeapBefore extHostInspector
verbose extHostHeapBefore
err
verbose
r
chatEditorSel
focusStart
focusStart
focused
el sel
el el el
chatEditorSel
focused
r
chatMessage
actualInputSelector
editor editorSel
editor
editor editorSel editorSel
chatEditorSel
hasDriver
globalThistypeInEditor
hasDriver
globalThisselector text
actualInputSelector chatMessage
actualInputSelector
r
actualInputSelectorchatMessage
cdp
cdp
completionsBefore mockServer
submitTime
mockServercompletionsBefore
firstResponseTime
responseSelector
responses sel
responses
responsesresponses
responseSelector
responseCompleteTime
userTurns scenario
ut ut userTurns ut
userTurn userTurnsut
verbose
r
chatEditorSel
utFocusStart
utFocusStart
focused
el sel
el el el
chatEditorSel
focused
r
hasDriver
globalThisselector text
actualInputSelector userTurn
actualInputSelector
r
actualInputSelectoruserTurn
utCompBefore mockServer
mockServerutCompBefore
input chatViewSel
input input
r
responses sel
responses
responsesresponses
responseSelector
responseCompleteTime
verbose
utResponseInfo
responses sel
last responsesresponses
last last
responseSelector
profile cdp
profilePath pathrunDiagDir
fsprofilePath profile
verbose
responseInfo
responses sel
last responsesresponses
last
text last
text text
responseSelector
verbose
responses sel
last responsesresponses
last
hasAnimating last
hasAnimating
responseSelector
prev
stableCount
stabilizeStart
stableCount stabilizeStart
current
responses sel
last responsesresponses
last last
responseSelector
current prev
stableCount
stableCount
prev current
r
renderCompleteTime
verbose
heapAfter cdp
metricsAfter cdp
extHostHeapUsedBefore
extHostHeapUsedAfter
extHostHeapDelta
extHostHeapDeltaPostGC
extHostProfilePath
extHostSnapshotPath
extHostInspector extHostHeapBefore
extHostHeapUsedBefore extHostHeapBefore
extProfile extHostInspector
extHostProfilePath pathrunDiagDir
fsextHostProfilePath extProfile
verbose
extHostHeapAfter extHostInspector
extHostHeapUsedAfter extHostHeapAfter
extHostHeapDelta extHostHeapUsedAfter extHostHeapUsedBefore
extHostInspector
r
extHostHeapPostGC extHostInspector
extHostHeapDeltaPostGC extHostHeapPostGC extHostHeapUsedBefore
extHostHeapDeltaPostGC
verbose
err
verbose
snapshotPath
takeHeapSnapshots
snapshotPromises
snapshotPromises
p pathrunDiagDir
cdp
chunks
cdp params
chunksparams
cdp
fsp chunks
p
extHostInspector extHostHeapBefore
snapshotPromises
p pathrunDiagDir
chunks
extHostInspector params
chunksparams
extHostInspector
fsp chunks
p
snapshotResults snapshotPromises
snapshotPath snapshotResults
snapshotResults
extHostSnapshotPath snapshotResults
verbose
extHostSnapshotPath
extHostInspector
extHostInspector
e r m m name
e e
partialMetrics
heapBefore
heapAfter
heapAfter heapBefore
cdp
r
heapPostGC cdp
heapPostGC heapBefore
metricsAfter metricsBefore
metricsAfter metricsBefore
metricsAfter metricsBefore
metricsAfter metricsBefore
metricsAfter metricsBefore
metricsAfter metricsBefore
responseInfo
profilePath
tracePath
snapshotPath
extHostHeapUsedBefore
extHostHeapUsedAfter
extHostHeapDelta
extHostHeapDeltaPostGC
extHostProfilePath
extHostSnapshotPath
extHostInspector
extHostInspector
activeVSCode
vscode
traceEvents
traceData fstracePath
traceEvents traceData
chatMarks traceEvents
e e e
e e
verbose chatMarks
timeToUIUpdated chatMarks
internalFirstToken chatMarks
timeToFirstToken internalFirstToken internalFirstToken firstResponseTime submitTime
timeToComplete responseCompleteTime submitTime
timeToRenderComplete renderCompleteTime submitTime
instructionCollectionTime chatMarks
agentInvokeTime chatMarks
majorGCs minorGCs gcDurationMs
event traceEvents
isGC event
event
event event c
t c
t t t
isGC
event event event
name event
name majorGCs
name minorGCs
minorGCs
event gcDurationMs event
layoutDurationMs
event traceEvents
event event event
layoutDurationMs event
longTaskCount
event traceEvents
event event event longTaskCount
longAnimationFrameCount
longAnimationFrameTotalMs
frameStarts
event traceEvents
event event
event
frameStartsevent event
event frameStartsevent
durationMs event frameStartsevent
frameStartsevent
durationMs
longAnimationFrameCount
longAnimationFrameTotalMs durationMs
partialMetrics
timeToUIUpdated timeToFirstToken timeToComplete timeToRenderComplete instructionCollectionTime agentInvokeTime
chatMarks
internalFirstToken
majorGCs minorGCs
gcDurationMs
layoutDurationMs
longTaskCount
longAnimationFrameCount
longAnimationFrameTotalMs
label
short label
label
isRef v v v
base test
baseLabel opts
testBuildMode jsonReport
testLabel testBuildMode
testBuildMode
opts testBuildMode
baseLink baseLabel
testLink testLabel
compareLink baseLabel testLabel
allMetrics
regressionMetricNames
lines
scenarios jsonReport
scenarioVerdicts
totalRegressions
totalImprovements
scenario scenarios
current jsonReportscenario
base baselinescenariosscenario
verdicts
base
metric group unit allMetrics
cur currentgroupmetric
bas basegroupmetric
cur bas bas bas
change bas cur bas bas
isRegressionMetric regressionMetricNamesmetric
curRaw current r rmetric v v
basRaw base r rmetric v v
ttest basRaw curRaw
pStr ttest
metricThreshold opts metric
absoluteDelta cur bas
verdict
isRegressionMetric
metricThreshold change absoluteDelta
ttest ttest
verdict
totalRegressions
verdict
metricThreshold change absoluteDelta ttestsignificant
verdict
totalImprovements
verdict
verdict
basStr
curStr
verdicts metric verdict change pStr basStr curStr
scenarioVerdictsscenario verdicts
hasRegressions totalRegressions
verdictIcon hasRegressions
verdictText hasRegressions
totalImprovements
lines
lines
lines
lines
lines
lines
compareLink
lines
lines
overrides opts
parsed v
parsed parsed opts
overrides
overrideStr overrides
parsed v
lines
lines
lines
lines
jsonReport
lines
lines
jsonReport
lines
lines
lines
lines
lines
lines
lines
lines
lines
scenario scenarios
verdicts scenarioVerdictsscenario
get m verdicts v m
ttft
complete
layouts
styles
loaf
fmtCell v
v
pct
pct
fmtVerdict vs
hasRegression vs v
hasImproved vs v
hasRegression
hasImproved
keyVerdicts ttft complete layouts styles loaf
rowVerdict keyVerdicts
lines
lines
hasNotable scenarioVerdicts vs v v
hasNotable
lines
lines
lines
lines
scenario scenarios
verdicts scenarioVerdictsscenario
notable verdicts v v
notable
icon notable v
lines
lines
lines
lines
v notable
pct
verdictIcon v
lines
lines
lines
lines
scenario scenarios
verdicts scenarioVerdictsscenario
base baselinescenariosscenario
lines
lines
base
current jsonReportscenario
lines
lines
lines
lines
metric group unit allMetrics
cur currentgroupmetric
cur
lines
lines
lines
lines
v verdicts
pct
verdictDisplay v
v verdictDisplay
v verdictDisplay
v verdictDisplay
v verdictDisplay
v verdictDisplay
lines
lines
lines
lines
lines
lines
scenario scenarios
current jsonReportscenario
lines
lines
lines
lines
runs current
i i runs i
r runsi
round2 v v
lines
lines
baseline
scenario scenarios
base baselinescenario
base
lines
lines
lines
lines
runs base
i i runs i
r runsi
round2 v v
lines
lines
lines
lines
lines
activeVSCode
activeMockServer
activeVSCode
activeMockServer
process
process cleanup
process cleanup
filesToDelete
metrics
metrics
metrics
metrics
metrics
filePath filesToDelete
filePath fsfilePath
fsfilePath
scenario runs allResults
regressedScenariosscenario
metrics runs
metrics
opts
startServer
mockServer
activeMockServer mockServer
opts
fsopts
process
prevResults fsopts
prevDir pathopts
baselineFiles fsprevDir f f f
baselineFile baselineFiles pathprevDir baselineFiles
prevBaseline baselineFile fsbaselineFile
resumeScenarios opts
opts prevResultss
prevResults
resumeScenarios
process
testElectron opts
baselineVersion prevBaselinebaselineBuildVersion
baselineElectron baselineVersion baselineVersion
runsToAdd opts
prevBaseline
scenario resumeScenarios
prevTestRuns prevResultsscenariorawRuns
prevBaseRuns prevBaselinescenariosscenariorawRuns
i i runsToAdd i
runIdx
m testElectron scenario mockServer opts runIdx prevDir opts opts opts opts
opts prevTestRuns prevTestRunsprevTestRuns
prevTestRunsm
opts
src m
err
baselineElectron prevBaselinescenariosscenario
i i runsToAdd i
runIdx
m baselineElectron scenario mockServer opts runIdx prevDir opts opts opts opts
opts prevBaseRuns prevBaseRunsprevBaseRuns
prevBaseRunsm
err
sd prevTestRuns prevTestRuns
metric group sdgroupmetric prevTestRuns r rmetric
prevResultsscenario sd
prevBaselinescenariosscenario
bsd prevBaseRuns prevBaseRuns
metric group bsdgroupmetric prevBaseRuns r rmetric
prevBaselinescenario bsd
prevResults prevResults prevResults s s
prevResults
fsopts prevResults
prevBaseline baselineFile
prevBaseline
fsbaselineFile prevBaseline
cachedPath path pathbaselineFile
fscachedPath prevBaseline
opts baselineFile
jsonReport prevResults
jsonReport opts
jsonReport opts
mockServer
opts opts
prodBuildPath
opts prodBuildPath
electronPath opts
fselectronPath
process
testBuildMode electronPath
isBaselineVersionString opts opts
isBaselineLocalPath opts isBaselineVersionString
baselineElectronPath
isBaselineLocalPath
baselineElectronPath opts
fsbaselineElectronPath
process
baselineBuildMode opts
isBaselineVersionString baselineElectronPath
isMismatchedBuildMode baselineBuildMode testBuildMode baselineBuildMode
runTimestamp
runDir path runTimestamp
fsrunDir
testSettings opts opts
baselineSettings opts opts
opts
baselineLabel isBaselineLocalPath
pathpathopts
opts
baselineJsonPath pathrunDir
cachedPath isBaselineLocalPath path
cachedBaseline cachedPath opts fscachedPath
fscachedPath
cachedBaselinebaselineBuildVersion opts
cachedScenarios cachedBaseline
missingScenarios opts s cachedScenarioss
shortScenarios opts s
cached cachedBaselines
cached cachedlength opts
missingScenarios shortScenarios
fsbaselineJsonPath cachedBaseline
opts baselineJsonPath
scenariosToRun missingScenarios shortScenarios
missingScenarios
shortScenarios
baselineExePath baselineElectronPath opts
scenario scenariosToRun
existingRuns cachedBaselinescenariorawRuns
runsNeeded opts existingRuns
newResults
i i runsNeeded i
m baselineExePath scenario mockServer opts runDir baselineSettings opts opts
opts newResults newResultsnewResults
newResultsm
err
allRuns existingRuns newResults
allRuns
sd allRuns allRuns
metric group sdgroupmetric allRuns r rmetric
cachedBaselinescenario sd
cachedBaseline opts
fsbaselineJsonPath cachedBaseline
cachedPath
fscachedPath cachedBaseline
opts baselineJsonPath
baselineExePath baselineElectronPath opts
baselineResults
scenario opts
results
i i opts i
m baselineExePath scenario mockServer opts runDir baselineSettings opts opts
opts results resultsresults
resultsm
err
results baselineResultsscenario results
baselineReport
opts
process
opts
scenario results baselineResults
sd results results
metric group sdgroupmetric results rmetric
baselineReportscenario sd
fsbaselineJsonPath baselineReport
cachedPath
fscachedPath baselineReport
opts baselineJsonPath
baselineBuildMode
opts
opts
opts
isMismatchedBuildMode
testBuildMode
opts opts
readline
rl readline process process
answer rl resolve
rl
answer
mockServer
process
allResults
anyFailed
scenario opts
results
i i opts i
metrics electronPath scenario mockServer opts runDir testSettings opts opts
opts results resultsresults
resultsmetrics
opts
src metrics
err
results anyFailed
allResultsscenario results
scenario results allResults
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
results r
jsonPath pathrunDir
jsonReport
process
opts
testBuildMode
isMismatchedBuildMode
scenario results allResults
sd results results
metric group sdgroupmetric results rmetric
jsonReportscenario sd
fsjsonPath jsonReport
jsonReport jsonPath
opts
opts process
fsopts jsonReport
regressedScenarios jsonReport opts
opts
allResults regressedScenarios
anyFailed process
mockServer
regressionFound
inconclusiveFound
regressedScenarios
opts fsopts
baseline fsopts
jsonReport
regressionMetrics
infoMetrics
scenario jsonReport
current jsonReportscenario
base baselinescenario
base
diffs
scenarioRegression
metric group unit regressionMetrics
cur currentgroupmetric
bas basegroupmetric
cur bas bas
change cur bas bas
pct
curRaw current r rmetric v v
basRaw base r rmetric v v
ttest basRaw curRaw
metricThreshold opts metric
absoluteDelta cur bas
flag
metricThreshold change absoluteDelta
ttest
flag
inconclusiveFound
ttest
flag
scenarioRegression
regressionFound
flag
inconclusiveFound
ttest change ttest ttest
flag
diffs
metric group unit infoMetrics
cur currentgroupmetric
bas basegroupmetric
cur bas bas bas
change bas cur bas bas
pct
diffs
scenarioRegression regressedScenariosscenario
diffs d
regressionFound
inconclusiveFound regressionFound
resultsPath jsonReport
jsonReport opts
maxNeeded
scenario jsonReport
current jsonReportscenario
base baselinescenario
base
metric group
curRaw current r rmetric v v
basRaw base r rmetric v v
curRaw basRaw
meanA basRaw s v s v basRaw
meanB curRaw s v s v curRaw
varA basRaw s v s v meanA basRaw
varB curRaw s v s v meanB curRaw
pooledSD varA varB
pooledSD
d meanB meanA pooledSD
d
nPerGroup d
currentN curRaw basRaw
maxNeeded maxNeeded nPerGroup currentN
suggestedRuns maxNeeded
opts
ciBaseline opts fsopts
fsopts
summary jsonReport ciBaseline
opts
opts
jsonReport opts
ciBaselinebaselineBuildVersion opts
opts
summaryPath path
fssummaryPath summary
summary
regressionFound process
regressedScenarios
err process
' --production-build Build a local bundled package (via gulp vscode) for'
,
' apples-to-apples comparison against a release baseline'
,
' --setting <k=v> Set a VS Code setting override for all builds (repeatable)'
,
' --test-setting <k=v> Set a VS Code setting override for test build only'
,
' --baseline-setting <k=v> Set a VS Code setting override for baseline build only'
,
' e.g. --setting chat.experimental.incrementalRendering.enabled=true'
,
' --no-cache Ignore cached baseline data, always run fresh'
,
' --force Skip build mode mismatch confirmation'
,
' --heap-snapshots Take heap snapshots (slow; auto-enabled in --ci mode)'
,
' --gc-object-stats Enable V8 gc_stats tracing for GC deep-dives only. WARNING: corrupts timings (adds ~550ms to any request hit by a major GC) — never use for benchmarking'
,
' --ci CI mode: write Markdown summary to ci-summary.md (implies --no-cache, --heap-snapshots, --cleanup-diagnostics)'
,
' --cleanup-diagnostics Remove heap snapshots, CPU profiles, and traces after each run to save disk space'
/**
* Classify an electron path into a build mode.
* @param{string}electronPath
* @returns{'dev'|'production'|'release'}
*/
function
detectBuildMode
(
electronPath
)
{
if
(
.
includes
(
'.vscode-test'
)
)
{
return
'release'
;
}
if
(
.
includes
(
'VSCode-'
)
)
{
return
'production'
;
}
return
'dev'
;
}
/**
* Return a human-readable label for a build mode.
* @param{'dev'|'production'|'release'}mode
* @returns{string}
*/
function
buildModeLabel
(
mode
)
{
switch
(
)
{
case
'dev'
:
return
'development (unbundled)'
;
case
'production'
:
return
'production (bundled, local)'
;
case
'release'
:
return
'release (bundled, downloaded)'
;
}
}
// -- Production build --------------------------------------------------------
/**
* Build a local production (bundled) VS Code package using `gulp vscode`.
* Returns the path to the Electron executable in the packaged output.
*
* The gulp task compiles TypeScript, bundles JS, and packages with Electron
* into `../VSCode-<platform>-<arch>/`. This is the same process used for
* release builds, minus minification and mangling.
*/
function
buildProductionBuild
(
)
{
const
=
require
(
.
join
(
ROOT
,
'product.json'
)
)
;
const
=
.
platform
;
const
=
.
arch
;
const
=
.
join
(
ROOT
,
'..'
,
`VSCode-${platform}-${arch}`
)
;
console
.
log
(
'[chat-simulation] Building local production package (gulp vscode)...'
)
;
console
.
log
(
'[chat-simulation] This may take a few minutes on the first run.'
)
;
const
{
}
=
require
(
'child_process'
)
;
try
{
execSync
(
'npm run gulp -- vscode'
,
{
cwd
:
ROOT
,
stdio
:
'inherit'
,
timeout
:
10
*
60
*
1000
,
// 10 minute timeout
}
)
;
}
catch
(
)
{
// The copilot shim step may fail locally when the copilot SDK is not
// fully packaged (it is normally supplied via CI). As long as the
// Electron executable was produced we can still benchmark.
console
.
warn
(
'[chat-simulation] gulp vscode exited with errors (see above). Checking if executable was still produced...'
)
;
}
/** @type{string} */
let
;
if
(
===
'darwin'
)
{
=
.
join
(
,
`${product.nameLong}.app`
,
'Contents'
,
'MacOS'
,
.
nameShort
)
;
}
else
if
(
===
'linux'
)
{
=
.
join
(
,
.
applicationName
)
;
}
else
{
=
.
join
(
,
`${product.nameShort}.exe`
)
;
}
if
(
!
.
existsSync
(
)
)
{
console
.
error
(
`[chat-simulation] Production build failed — executable not found at: ${electronPath}`
)
;
.
exit
(
1
)
;
}
// Merge product.overrides.json into the packaged product.json.
// The overrides file contains extensionsGallery and other config that
// the OSS product.json lacks. In dev builds these are loaded at
// runtime when VSCODE_DEV is set, but the production build doesn't
// set that flag so we bake them in.
const
=
.
join
(
ROOT
,
'product.overrides.json'
)
;
if
(
.
existsSync
(
)
)
{
/** @type{string} */
let
;
if
(
===
'darwin'
)
{
=
.
join
(
,
`${product.nameLong}.app`
,
'Contents'
,
'Resources'
,
'app'
)
;
}
else
{
=
.
join
(
,
'resources'
,
'app'
)
;
}
const
=
.
join
(
,
'product.json'
)
;
if
(
.
existsSync
(
)
)
{
const
=
JSON
.
parse
(
.
readFileSync
(
,
'utf-8'
)
)
;
const
=
JSON
.
parse
(
.
readFileSync
(
,
'utf-8'
)
)
;
const
=
Object
.
assign
(
,
)
;
.
writeFileSync
(
,
JSON
.
stringify
(
,
null
,
'\t'
)
)
;
console
.
log
(
'[chat-simulation] Merged product.overrides.json into packaged product.json'
)
;
}
}
console
.
log
(
`[chat-simulation] Production build ready: ${electronPath}`
)
;
return
;
}
/**
* @typedef{{ type:'fraction', value: number }|{ type:'absolute', value: number }}MetricThreshold
*/
/**
* Parse a metric threshold value from config.
* - A number is treated as a fraction (e.g. 0.2 = 20%).
* - A string like "100ms" or "5" is treated as an absolute delta.
* @param{number | string}raw
* @returns{MetricThreshold}
*/
function
parseMetricThreshold
(
raw
)
{
if
(
typeof
===
'number'
)
{
return
{
type
:
'fraction'
,
value
:
}
;
}
// Strip unit suffix (ms, MB, etc.) and parse the number
const
=
parseFloat
(
)
;
if
(
isNaN
(
)
)
{
throw
new
Error
(
`Invalid metric threshold: ${raw}`
)
;
}
return
{
type
:
'absolute'
,
value
:
}
;
}
/**
* Get the regression threshold for a specific metric.
* Uses per-metric override from config if available, otherwise the global threshold.
* @param{{ threshold: number, metricThresholds?: Record<string, number | string>}}opts
* @param{string}metric
* @returns{MetricThreshold}
*/
// with matching ids. Compute duration from each s→f pair.
let
=
0
;
let
=
0
;
{
/** @type{Map<number, number>} */
const
=
new
Map
(
)
;
for
(
const
of
)
{
if
(
.
cat
===
'devtools.timeline'
&&
.
name
===
'AnimationFrame'
)
{
if
(
.
ph
===
's'
)
{
.
set
(
.
id
,
.
ts
)
;
}
else
if
(
.
ph
===
'f'
&&
.
has
(
.
id
)
)
{
const
=
(
.
ts
-
/** @type{number} */
(
.
get
(
.
id
)
)
)
/
1000
;
.
delete
(
.
id
)
;
if
(
>
50
)
{
++
;
+=
;
}
}
}
}
}
return
{
...
,
,
,
,
,
,
,
hasInternalMarks
:
.
length
>
0
,
,
,
,
gcDurationMs
:
Math
.
round
(
*
100
)
/
100
,
layoutDurationMs
:
Math
.
round
(
*
100
)
/
100
,
,
,
longAnimationFrameTotalMs
:
Math
.
round
(
*
100
)
/
100
,
}
;
}
// -- CI summary generation ---------------------------------------------------
const
GITHUB_REPO
=
'https://github.com/microsoft/vscode'
;
/**
* Format a build identifier as a Markdown link when possible.
* - Commit SHAs link to the commit page.
* - Semver versions link to the release tag page.
* - Everything else (e.g. "baseline", "dev (local)") is returned as inline code.
* @param{string}label
* @returns{string}
*/
/**
* Build a GitHub compare link between two build identifiers, if both are
* commit-like or version-like references. Returns empty string otherwise.
* @param{string}base
* @param{string}test
* @returns{string}
*/
/**
* Remove large diagnostic files (heap snapshots, CPU profiles, traces) from
* a run's metrics to free disk space. Keeps the JSON results data intact.
* @param{RunMetrics}metrics
*/
function
cleanupRunDiagnostics
(
metrics
)
{
const
=
[
.
profilePath
,
.
tracePath
,
.
snapshotPath
,
.
extHostProfilePath
,
.
extHostSnapshotPath
,
]
;
for
(
const
of
)
{
if
(
&&
.
existsSync
(
)
)
{
try
{
.
rmSync
(
,
{
force
:
true
}
)
;
}
catch
{
// Ignore cleanup errors
}
}
}
}
/**
* Clean up diagnostics for all scenarios that did NOT regress.
* Keeps diagnostics for regressed scenarios so they can be investigated.
* @param{Record<string, RunMetrics[]>}allResults - test results by scenario
* @param{Set<string>}regressedScenarios - scenarios that regressed
*/
function
cleanupNonRegressedDiagnostics
(
allResults, regressedScenarios
)
{
for
(
const
[
,
]
of
Object
.
entries
(
)
)
{
if
(
.
has
(
)
)
{
continue
;
}
for
(
const
of
)
{
cleanupRunDiagnostics
(
)
;
}
}
}
// -- Main --------------------------------------------------------------------