From 471a050205a29f7f0590ac894f1870df7726b47e Mon Sep 17 00:00:00 2001 From: Stefan Dirix Date: Tue, 12 Sep 2023 16:27:52 +0200 Subject: [PATCH] chore: improve frontend startup performance 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 --- CHANGELOG.md | 1 + packages/core/src/browser/common-frontend-contribution.ts | 1 + .../src/browser/debug-frontend-application-contribution.ts | 4 ++-- packages/editor/src/browser/editor-navigation-contribution.ts | 2 +- .../terminal/src/browser/terminal-frontend-contribution.ts | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6348661ba1e7f..48c86f027efba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## v1.42.0 +- [core] Improve frontend startup time [#12936](https://github.com/eclipse-theia/theia/pull/12936) - 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 ## v1.41.0 - 08/31/2023 diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 7df314fd08cb5..c446f1e88c729 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -428,6 +428,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi protected pinnedKey: ContextKey; async configure(app: FrontendApplication): Promise { + // FIXME: This request blocks valuable startup time (~200ms). const configDirUri = await this.environments.getConfigDirUri(); // Global settings this.encodingRegistry.registerOverride({ diff --git a/packages/debug/src/browser/debug-frontend-application-contribution.ts b/packages/debug/src/browser/debug-frontend-application-contribution.ts index 4ca406c3860b4..5e833a8a39f29 100644 --- a/packages/debug/src/browser/debug-frontend-application-contribution.ts +++ b/packages/debug/src/browser/debug-frontend-application-contribution.ts @@ -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 { diff --git a/packages/editor/src/browser/editor-navigation-contribution.ts b/packages/editor/src/browser/editor-navigation-contribution.ts index 9aa98da47d800..36c5ed2ad6d50 100644 --- a/packages/editor/src/browser/editor-navigation-contribution.ts +++ b/packages/editor/src/browser/editor-navigation-contribution.ts @@ -175,7 +175,7 @@ export class EditorNavigationContribution implements Disposable, FrontendApplica } async onStart(): Promise { - await this.restoreState(); + this.restoreState(); } onStop(): void { diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index a4feb00b0c0a6..5ca103b796db7 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -268,7 +268,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu } async onStart(app: FrontendApplication): Promise { - await this.contributeDefaultProfiles(); + this.contributeDefaultProfiles(); this.terminalPreferences.onPreferenceChanged(e => { if (e.preferenceName.startsWith('terminal.integrated.')) {