redhat-developer / redhat-developer/vscode-yaml

Performance issue in used yaml parser makes usage prohibitively slow

Open
#1,063 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

I just started recently using your extension and was quite pleased by the YAML language support it offers inside VScode.
Unfortunately, as I progressed with my project, my YAML files got slightly longer and I realized that your extension seems to run into some performance issues. Especially the extensive use of anchors/aliases is not viable after the file reaches certain length. Code completion will take several seconds to load, schema suggestions won't load in a timely manner etc.
This makes the extension and its features as it is unusable for me.

I did some research and figured out that the yaml parser this extension is using is rather slow in parsing yaml files with anchors/aliases in them. This is a known issue https://github.com/eemeli/yaml/issues/537 of this parser that has not been addressed yet.
I did a similar performance comparison as described in this issue with my file and could confirm that the here used yaml parser by eemeli is more than an order of magnitude slower than the js-yaml parser.

The performance issue was therefore introduced by switching to the new parser that took place after suggested by its author in this issue: https://github.com/redhat-developer/yaml-language-server/issues/421

Using the outdated version 0.23.0 of vscode-yaml is for now my solution to still being able to handle my large yaml files and have at least some efficient language support. Of course, this comes with many downsides, as this version goes back several years. It would be great to have an efficient working vscode-yaml extension including the latest features.

Steps to Reproduce

  1. Have a larger yaml file (5k lines) including around 50 anchors/aliases
  2. Have a schema defining the structure of the above file
  3. Try to use code completions/aliases/schema validation

Environment

  • Windows
  • Mac
  • Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Reproduce the slowdown with a 5k-line YAML file containing about 50 anchors or aliases and a schema, then inspect the current parser path against the linked eemeli/yaml performance issue. Done means completions, aliases, and schema validation respond efficiently while retaining current YAML language support.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, yaml
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.