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

[YAML] Improve Performance #3924

Merged
merged 2 commits into from
Feb 18, 2024
Merged

Conversation

deathaxe
Copy link
Collaborator

@deathaxe deathaxe commented Feb 17, 2024

This PR proposes some changes to improve parsing performance by about 18-20%

Syntax cache size drops from 58kB to 41kB (-30%).

This commit improves parsing performance by about 4-6%.
This commit improves parsing performance by about 16%.

It reorganizes imports in `block-node-11` and `block-node-12` contexts
in order to avoid `flow-scalar-plain-out-1x` and `flow-scalar-plain-in-1x`
being included at the same time.
@michaelblyons
Copy link
Collaborator

@keith-hall and @FichteFoll, this doesn't change anything you're extending, does it? Otherwise looks good to me.

@deathaxe
Copy link
Collaborator Author

I've checked against

  1. PackageDev (Sublime Syntax Definition Syntax)

    • uses flow-scalar-plain-out-implicit-type-12, block-sequence, property
  2. YAML Pipelines

    • extends top-level node context

@deathaxe deathaxe merged commit 44489d0 into sublimehq:master Feb 18, 2024
2 checks passed
@deathaxe deathaxe deleted the pr/yaml/optimize branch February 18, 2024 19:31
Comment on lines +97 to +98
\s+ \#
| \s* (?: $ | {{c_flow_indicator}} | : (?:\s|$|{{c_flow_indicator}}) )
Copy link
Collaborator

@FichteFoll FichteFoll Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the effect on performance here caused by not grouping or by using a capturing group? Because I find the new grouping much harder to follow (though that could probably be solved by just splitting it over multiple lines).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The duplicate \s* had most impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants