Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore delaying doing * activation extensions until initial activation events are finished #171135

Closed
joyceerhl opened this issue Jan 12, 2023 · 1 comment
Assignees
Labels
extension-activation Issues related to extension activation extensions Issues concerning extensions perf
Milestone

Comments

@joyceerhl
Copy link
Contributor

Today extensions which are * activated are resolved alongside other eager activation events. Explore whether deferring discovering and activating * activated extensions until the initial eager events have settled leads to better performance (e.g. in vscode.dev/github).

@joyceerhl joyceerhl added extensions Issues concerning extensions perf extension-activation Issues related to extension activation labels Jan 12, 2023
@joyceerhl joyceerhl added this to the February 2023 milestone Jan 12, 2023
@joyceerhl joyceerhl self-assigned this Jan 12, 2023
@joyceerhl
Copy link
Contributor Author

joyceerhl commented Jan 20, 2023

Notes from initial investigation

Initial activation events that we want to see settle before handling * and workspaceContains eager events include:

  • onFileSystem:vscode-vfs
  • onFileSystem:review

Eager activation happens here:

private _handleEagerExtensions(): Promise<void> {
const starActivation = this._activateByEvent('*', true).then(undefined, (err) => {
this._logService.error(err);
});
this._register(this._extHostWorkspace.onDidChangeWorkspace((e) => this._handleWorkspaceContainsEagerExtensions(e.added)));
const folders = this._extHostWorkspace.workspace ? this._extHostWorkspace.workspace.folders : [];
const workspaceContainsActivation = this._handleWorkspaceContainsEagerExtensions(folders);
const eagerExtensionsActivation = Promise.all([starActivation, workspaceContainsActivation]).then(() => { });
Promise.race([eagerExtensionsActivation, timeout(10000)]).then(() => {
this._activateAllStartupFinished();
});
return eagerExtensionsActivation;
}

Debugging opening microsoft/vscode using Remote Repositories on desktop, these are the activation events I see coming in before eager activation takes place:

  • onFileSystem:file <-- this shouldn't show up in web
  • onFileSystem:vscode-userdata
  • onView:timeline 🤔 (this is unexpected because it fires even when the timeline view is collapsed)
  • onFileSystem:vscode-vfs
  • onLanguage:Log 🤔 (this is unexpected because there are no open editors at this point, is this extension output channels-related perhaps?)

After eager extension activation events are activated but before the explorer has resolved, I also see:

  • onSearch:vscode-vfs via here 🤔 (this is unexpected because the search viewlet is not focused at this point)

(Note, when viewing a PR, the actual onFileSystem:review event doesn't fire till after Remote Repositories has activated, figured out that we're looking at a PR based on the workspaceFolder URI, and activated the GHPRI extension via executing github.api.preloadPullRequest. If we wanted onFileSystem:review to be an 'initial' activation event that gets prioritized over eager events, we would likely need a faster path for firing onFileSystem:review.)

At a high level, I'm thinking of queuing all extension activation requests in the extHostExtensionActivator, then ensuring that when we see an eager event like * or workspaceContains, we wait for all queued activation promises to complete before handling the eager event itself.

@joyceerhl joyceerhl modified the milestones: February 2023, March 2023 Feb 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extension-activation Issues related to extension activation extensions Issues concerning extensions perf
Projects
None yet
Development

No branches or pull requests

1 participant