Skip to content

Slow startup time #197

@sethidden

Description

@sethidden

NVIMPluginController.init() sometimes takes ~5s to finish execution on my computer (1.8 Ghz but still)
So I went along and measured how long each await in NVIMPluginController.init() takes in a very stupid way

export const logTime = (label: string) => {
        console.log(label + " ");
        console.timeLog("label");
};
public async init(): Promise<void> {
        logTime("init");
        let resolveInitPromise: () => void = () => {
            /* ignore */
        };
        this.nvimInitPromise = new Promise(res => {
            resolveInitPromise = res;
        });
        await this.client.setClientInfo("vscode-neovim", { major: 0, minor: 1, patch: 0 }, "embedder", {}, {});
        logTime("setClientInfo");
        const channel = await this.client.channelId;
        logTime("channelId");

Output console of running vscode-neovim with the above logTime() calls - timings etc.
(There's lots of unnecessary output there, the format for the logTime() is:

functionName or whatever
label: [time in ms since start of activate() in extension.ts and end of execution of above function in line above]

but sometimes it outputs only the label: timeInMs for some reason

So if you round up the above data, here are the timings of the init() awaits chronologically (I omitted some functions that were very fast):

  • await this.client.setClientInfo("vscode-neovim", { major: 0, minor: 1, patch: 0 }, "embedder", {}, {}); - 174ms
  • const channel = await this.client.channelId - 1301 ms Δ1100ms - this is from the node neovim client. Link to code in neovim node-client code snippet
  • await this.client.setVar("vscode_channel", channel); - 1601ms Δ300ms
  • await this.client.uiAttach(...) 2503ms Δ900ms Link to neovim node-client
  • const firstWin = await this.client.window; - 2865ms Δ350ms
  • await this.client.callAtomic(winOptionsRequests) - 3747ms Δ900ms
  • (counts all calls in for loop cumulatively) await.thisBuffer(e) - 4200ms Δ450ms
  • await this.onChangedActiveEditor(vscode.window.activeTextEditor - 5200ms Δ1000ms

The above was performed on commit 68f056b4c9cb6b2559baa917f8c02166abd86f11 (vscode-neovim v0.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions