Skip to content

Commit 3965d65

Browse files
authored
perf - mark times for creating workbench contributions (microsoft#159548)
* perf - mark times for creating workbench contributions * fix layer issue * do not use `measure` for now
1 parent ba8636b commit 3965d65

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/vs/workbench/common/contributions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { IInstantiationService, IConstructorSignature, ServicesAccessor, Branded
77
import { ILifecycleService, LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
88
import { Registry } from 'vs/platform/registry/common/platform';
99
import { runWhenIdle, IdleDeadline } from 'vs/base/common/async';
10+
import { mark } from 'vs/base/common/performance';
1011

1112
/**
1213
* A workbench contribution that will be loaded when the workbench starts and disposed when the workbench shuts down.
@@ -90,14 +91,23 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
9091
if (toBeInstantiated) {
9192
this.toBeInstantiated.delete(phase);
9293
if (phase !== LifecyclePhase.Eventually) {
94+
9395
// instantiate everything synchronously and blocking
96+
// measure the time it takes as perf marks for diagnosis
97+
98+
mark(`code/willCreateWorkbenchContributions/${phase}`);
99+
94100
for (const ctor of toBeInstantiated) {
95101
this.safeCreateInstance(instantiationService, ctor); // catch error so that other contributions are still considered
96102
}
103+
104+
mark(`code/didCreateWorkbenchContributions/${phase}`);
97105
} else {
106+
98107
// for the Eventually-phase we instantiate contributions
99108
// only when idle. this might take a few idle-busy-cycles
100109
// but will finish within the timeouts
110+
101111
const forcedTimeout = 3000;
102112
let i = 0;
103113
const instantiateSome = (idle: IdleDeadline) => {

0 commit comments

Comments
 (0)