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

Emmet - a perf hooligan? #71381

Closed
jrieken opened this issue Mar 28, 2019 · 10 comments
Closed

Emmet - a perf hooligan? #71381

jrieken opened this issue Mar 28, 2019 · 10 comments
Assignees
Labels
extensions Issues concerning extensions freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues perf
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Mar 28, 2019

The top 5 of extensions blocking the extension host process has a newcomer and that's emmet. In 1.31.1 it was top 20, with 1.32.3 it 2nd with 26037 hangs over 5 seconds. I don't have a profile at hand and I also don't use emmet but looking at its implementation might explain it, esp since it doesn't do things in LSP-style but in-proc, e.g probably slowing everything down when a file is large/huge

@octref
Copy link
Contributor

octref commented Mar 28, 2019

Likely the cause of #70371, will investigate.

Emmet re-parses the file on each edit to determine which region (html attribute? html attribute value? css-in-html? jsx in ts file? css property?) emmet is in.

IMO the proper solution would be either having an API where extensions can figure out regions, but we have decided to not expose TM scopes to extensions.

The alternative is to have emmet hook into the on completion visitors of each LS. I remember @ramya-rao-a said there was issues with JS/CSS LS and with completion trigger characters.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Mar 28, 2019

@jrieken When you say "top 5" and "top 20" is this something coming from the users or telemetry or your local usage?

@octref
AFAIK Nothing has changed in terms of emmet parsing files in almost a year, so what can explain the sudden change?

Regarding the alternative for emmet to hook into html and css completion providers, we did find good results with html, but not with css. The css language server is not great in identifying the right places where emmet should kick in, especially in in-complete css files. Please see #29113

@octref
Copy link
Contributor

octref commented Mar 28, 2019

@ramya-rao-a I'll see what has changed. The only one I recall is #68326, but that's related to wrapping not typing emmet abbreviations in general. Thanks for linking #29113 too.

I'm also interested in the full list.

@octref
Copy link
Contributor

octref commented May 9, 2019

Using @emmetio/html-matcher to parse the HTML source of https://microsoft.github.io/language-server-protocol/specification takes 2-3 seconds. That's happening for each document change.

In comparison, HTML parser took between 50-100ms.

@octref
Copy link
Contributor

octref commented May 10, 2019

@ramya-rao-a Wondering what's the original reason for choosing @emmetio/html-parser instead of using vscode-html-languageservice. I think the proper solution to #70371 is either replacing the parser or do incremental parsing by:

  • Look at changes
  • Find closest ancestry html node that contain the changes
  • Only use the parser to parse that region

@ramya-rao-a
Copy link
Contributor

@octref The issue you linked is to a non emmet problem, can you link the right issue?

From what I recall, we had good results from moving emmet completions for html to the html language service. What didn't work out well was the move for css/scss/less etc. And the call we took at the time was that we either move both or none at all.

The only caveat with moving to html language service is the problem of how to support emmet completions in non html files

@octref
Copy link
Contributor

octref commented May 12, 2019

Fixed link.

We can just switch to using the html parser, which seems to be much faster than emmet's, and still keep emmet as a separate extension.

@octref octref added this to the July 2019 milestone Jun 27, 2019
@shepelevstas
Copy link

Is it solved? I just updated to the latest version and it fills like emmet got slower.
emmet

@octref octref modified the milestones: July 2019, August 2019 Jul 31, 2019
@Download
Copy link

According to this issue it should be fixed:
#70371

@octref octref modified the milestones: August 2019, September 2019 Aug 26, 2019
@octref octref modified the milestones: September 2019, October 2019 Sep 25, 2019
@octref octref modified the milestones: October 2019, November 2019 Oct 28, 2019
@octref
Copy link
Contributor

octref commented Nov 7, 2019

I fixed two major perf issues for emmet. Think those are the most common cases for hangs (completion, tab-expansion).

Look forward to see a new list of hooligans.

@octref octref closed this as completed Nov 7, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions Issues concerning extensions freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues perf
Projects
None yet
Development

No branches or pull requests

6 participants