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

 - DebugFrontendApplicationContribution.onStart (~300ms)
 - EditorNavigationContribution.onStart (~36-400ms)
 - TerminalFrontendContribution.onStart (~100-300ms)

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

Contributed on behalf of STMicroelectronics
  • Loading branch information
sdirix committed Sep 27, 2023
1 parent 7e3aa42 commit 4400ff0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## v1.42.0

- [core] fixed logger level propagation when log config file changes at runtime [#12566](https://github.com/eclipse-theia/theia/pull/12566) - Contributed on behalf of STMicroelectronics
- [core] improve frontend startup time [#12936](https://github.com/eclipse-theia/theia/pull/12936) - Contributed on behalf of STMicroelectronics
- [vscode] stub TestController invalidateTestResults [#12944](https://github.com/eclipse-theia/theia/pull/12944) - Contributed by STMicroelectronics
- [vscode] support iconPath in QuickPickItem [#12945](https://github.com/eclipse-theia/theia/pull/12945) - Contributed by STMicroelectronics
- [vsx-registry] added a hint to extension fetching ENOTFOUND errors [#12858](https://github.com/eclipse-theia/theia/pull/12858) - Contributed by STMicroelectronics
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
protected pinnedKey: ContextKey<boolean>;

async configure(app: FrontendApplication): Promise<void> {
// FIXME: This request blocks valuable startup time (~200ms).
const configDirUri = await this.environments.getConfigDirUri();
// Global settings
this.encodingRegistry.registerOverride({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi

this.schemaUpdater.update();
this.configurations.load();
await this.breakpointManager.load();
await this.watchManager.load();
this.breakpointManager.load();
this.watchManager.load();
}

onStop(): void {
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 @@ -268,7 +268,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 4400ff0

Please sign in to comment.