[json] schema Validation/Intellisense very slow when JSON deep and Schema Complex
See original GitHub issueIn my project we design an API that allows people to define web pages in json using a bunch of nested components. We have schema files for all components and how to combine them. When merged into 1 schema file it becomes around 7000 lines long.
I am noticing a huge slowdown when a file has JSON that is relatively deep.
Here is what it looks like when the depth is still okay
And here is what it looks like when a deep component is defined in the same file
- VSCode Version: Version 1.20.0-insider
- OS Version: OSX 10.13.3
Steps to Reproduce:
- Set schema for JSON to some large and complex schema
- Open up a JSON file that uses the schema
- write enough JSON so that you are nested a bunch
- try to use intellisense
- whole editor slows down
- Intellisense suggestion doesn’t pop up until validation is done - even looks like it validates the file a few ways while you sit
Is it possible to just turn off JSON validation and keep the Intellisense? Or just validate on file save? Could we show Intellisense suggestions before validation happens?
Also, when i am editing 2 JSON files the slowness is shared by the two. Even after closing the file that made everything slow, I still have to wait for some validation thing to finish before it realized the file is closed and updates the UI
If needed I can try to reproduce this bug with generic schema files.
What seems to be the issue is when i have a Collection component. This component can hold any other component, including more nested collections. If I nest a bunch of collections the problem presents itself.
Does this issue occur when all extensions are disabled?: Yes/No Yes
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thanks a lot for the example, and sorry for the wait. It’s an interesting example, and the our schema validation gets to its limits.
Each node can have have multiple alternatives. When testing which alternative to use we test the full object, including children and children’s children. Each child type again has many alternatives.
To make this more performant we need to avoid validating children if we see that we are of the wrong type.
I have also provided a test file which shows the slowness