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

Defer work in extension activation #4053

Closed
joyceerhl opened this issue Oct 13, 2022 · 3 comments · Fixed by #4121
Closed

Defer work in extension activation #4053

joyceerhl opened this issue Oct 13, 2022 · 3 comments · Fixed by #4121
Assignees
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@joyceerhl
Copy link
Contributor

The GHPRI extension currently takes upwards of 300ms to activate on my machine and @Tyriar's. If we could improve when GHPRI gets activated #4046 we could avoid paying this cost frequently, but perhaps there is work that we can defer to reduce overall extension activation time.

@Tyriar
Copy link
Member

Tyriar commented Oct 14, 2022

I notice activate is actually an async function here so those numbers might not reflect what we're thinking:

https://github.com/microsoft/vscode-pull-request-github/blob/main/src/extension.ts#L225

I wonder what the time would be if this:

await vscode.commands.executeCommand('setContext', 'openDiffOnClick', openDiff);
// initialize resources
Resource.initialize(context);
Logger.debug('Creating API implementation.', 'Activation');
const apiImpl = new GitApiImpl();
const version = vscode.extensions.getExtension(EXTENSION_ID)!.packageJSON.version;
telemetry = new ExperimentationTelemetry(new TelemetryReporter(EXTENSION_ID, version, ingestionKey));
context.subscriptions.push(telemetry);
await deferredActivate(context, apiImpl, showPRController);

Was:

vscode.commands.executeCommand('setContext', 'openDiffOnClick', openDiff).then(() => {
  ...
})

Also I'm guessing async extension activation does not block other extensions activating?

@alexr00 alexr00 added this to the November 2022 milestone Oct 17, 2022
@alexr00 alexr00 added the feature-request Request for new features or functionality label Oct 28, 2022
@alexr00
Copy link
Member

alexr00 commented Oct 28, 2022

Found some places to improve. I measured from the start of activation until we're ready to display the tree of a checked out PR.
2.2 s speed up on desktop, for a total time of about 7 s.
170 ms speed up on vscode.dev, for a total time of about 2 s.

GHPRI is much faster on vscode.dev compared to desktop already and it seems like a combination of node-fetch being slow to make the first fetch and shelling out to git.

@alexr00
Copy link
Member

alexr00 commented Nov 28, 2022

I don't see a great way to verify this. Marking as verified to remove from our endgame queries.

@alexr00 alexr00 added verified Verification succeeded verification-needed Verification of issue is requested labels Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants