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

Slow spawn from ext host process when built from sources #132654

Closed
solomatov opened this issue Sep 8, 2021 · 8 comments
Closed

Slow spawn from ext host process when built from sources #132654

solomatov opened this issue Sep 8, 2021 · 8 comments
Assignees

Comments

@solomatov
Copy link
Contributor

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.60.1
  • OS Version: Darwin x64 20.6.0

We noticed that vscode which is built locally, started to work much slower than previous version. Profiling shown that spawns take much more time than before (15ms vs 300-1500ms). One of the most notable places is getHead in the git extension.

Steps to Reproduce:

  1. Checkout release 1.60
  2. Go to extensions/git/src/git.ts
  3. Add a measuring around the getHead() method
  4. Locally compile vs code, and open the same repo
  5. You will have getHead taking around 300ms
  6. If you will do it, say on 1.55, it will much less than that (15ms)

On 1.55, it took much less (~15ms). It seems that it's caused by libuv/libuv#3050 which was reverted due to broken tests (libuv/libuv#3050 (comment)). It seems that vscode uses patched version of electron (is it true?). Is it possible that you share the patched electron with the community?

cc @deepak1556

@solomatov
Copy link
Contributor Author

Confirmed that the behavior is different in locally built vs MS version of VS Code.

If you have extension like this (derived from yo template), time on OSS vs time on MS version is different and consistent with what we have above:

import * as vscode from 'vscode';
import * as cp from 'child_process';

export function activate(context: vscode.ExtensionContext) {
	console.log('Congratulations, your extension "test-it" is now active!');

	let disposable = vscode.commands.registerCommand('test-it.helloWorld', async () => {

		const folder = vscode.workspace.workspaceFolders![0];
		const path = folder.uri.fsPath;


		const start = Date.now();

		cp.spawnSync('git', ['status']);

		console.log('status took', Date.now() - start, 'ms');
	});
}

// this method is called when your extension is deactivated
export function deactivate() {}

@deepak1556 deepak1556 assigned deepak1556 and unassigned eamodio Sep 8, 2021
@deepak1556
Copy link
Collaborator

deepak1556 commented Sep 8, 2021

You can try newer version of patch from libuv/libuv#3257 and build electron.

Is it possible that you share the patched electron with the community?

Unfortunately it is not quite easy to do it and not worth the effort for short-term.

@solomatov
Copy link
Contributor Author

@deepak1556 Ok. Will do it. Thanks for your help!

@solomatov
Copy link
Contributor Author

@deepak1556 BTW, which patch do you use in the latest vscode? (may be there're other patches as well)

@deepak1556
Copy link
Collaborator

deepak1556 commented Sep 9, 2021

Current stable is based on Electron 13 which uses the patch attached in electron/electron#26143 (comment) . It is not very different from the libuv PR, just adapted to Electron 13 branch

@solomatov
Copy link
Contributor Author

@deepak1556 Thanks, I will!

@solomatov
Copy link
Contributor Author

@deepak1556 One more question if you don't mind. How do you build it? I assume you have some hidden repo, but electron has only cricle ci scripts. Do you have any other scripts to run it on github or azure?

Also, I assume that you plug your custom build here: https://github.com/microsoft/vscode/blob/main/build/lib/electron.ts#L204 Is there an easy way to plug a locally built electron in there?

@deepak1556
Copy link
Collaborator

deepak1556 commented Sep 13, 2021

Yes our custom build uses Azure pipelines. The scripts are not generic enough to share for external usage.

Also, I assume that you plug your custom build here: https://github.com/microsoft/vscode/blob/main/build/lib/electron.ts#L204 Is there an easy way to plug a locally built electron in there?

You can provide a new repo value for repo via product.json which contains binaries published in the format like https://github.com/electron/electron/releases/tag/v14.0.0

@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants