Skip to content

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

Closed

Description

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 Robo (@deepak1556)

Activity

  1. solomatov commented on Sep 8, 2021

    @solomatov
    ContributorAuthor

    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() {}
    
  2. deepak1556 commented on Sep 8, 2021

    @deepak1556
    Collaborator

    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.

  3. solomatov commented on Sep 8, 2021

    @solomatov
    ContributorAuthor

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

  4. solomatov commented on Sep 9, 2021

    @solomatov
    ContributorAuthor

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

  5. deepak1556 commented on Sep 9, 2021

    @deepak1556
    Collaborator

    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

  6. solomatov commented on Sep 9, 2021

    @solomatov
    ContributorAuthor

    Robo (@deepak1556) Thanks, I will!

  7. solomatov commented on Sep 9, 2021

    @solomatov
    ContributorAuthor

    Robo (@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?

  8. deepak1556 commented on Sep 13, 2021

    @deepak1556
    Collaborator

    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

  9. locked and limited conversation to collaborators on Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions