Skip to content

Commit

Permalink
chore: improve frontend startup performance
Browse files Browse the repository at this point in the history
The frontend awaits 'initialize', 'configure' and 'onStart' for all
frontend contributions. It's therefore very important that no expensive
code is run there.

By not awaiting expensive operations in

 - CommonFrontendContribution.configure (~200ms)
 - EditorNavigationContribution.onStart (~36-400ms)
 - TerminalFrontendContribution.onStart (~100-300ms)

the reported startup time without using plugins is reduced by ~300-900ms
which is an improvement of ~20-40%.

Contributed on behalf of STMicroelectronics
  • Loading branch information
sdirix committed Sep 12, 2023
1 parent 6843880 commit c255f10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,12 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
protected pinnedKey: ContextKey<boolean>;

async configure(app: FrontendApplication): Promise<void> {
const configDirUri = await this.environments.getConfigDirUri();
// Global settings
this.encodingRegistry.registerOverride({
encoding: UTF8,
parent: new URI(configDirUri)
this.environments.getConfigDirUri().then(uri => {
// Global settings
this.encodingRegistry.registerOverride({
encoding: UTF8,
parent: new URI(uri)
});
});

this.contextKeyService.createKey<boolean>('isLinux', OS.type() === OS.Type.Linux);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class EditorNavigationContribution implements Disposable, FrontendApplica
}

async onStart(): Promise<void> {
await this.restoreState();
this.restoreState();
}

onStop(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu
}

async onStart(app: FrontendApplication): Promise<void> {
await this.contributeDefaultProfiles();
this.contributeDefaultProfiles();

this.terminalPreferences.onPreferenceChanged(e => {
if (e.preferenceName.startsWith('terminal.integrated.')) {
Expand Down

0 comments on commit c255f10

Please sign in to comment.