-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Performance issue on relatively small file #537
Comments
Interesting. Thank you for sharing the file that's demonstrating this! Looks like the slowdown is during the document -> JS conversion. Probably due to the alias resolution? I'll see when I can find time to dig into this properly; might take a while. |
loading a 3.7MB file of a simple single-level dictionary was taking 77 seconds on my machine fast mac (m1 max). |
@rejetto Do you mean parsing each line as a separate YAML document? |
yes, invoking parse on the single line. |
As far as I can tell, this is simply the cost of using generators everywhere.
To ensure I wasn't imagining things, I rewrote the lexer code, replacing generators with a simple approach that pushes results to a traditional array, and in worst case scenario I got 4x speed up. It's safe to assume that the same is happening in parsing code to at least some degree. Sadly this is a dealbreaker, my startup time went from 380ms to 10s after porting from |
Describe the bug
Parsing the file located here with
yaml.parse(str, {merge:true})
takes a very long time. Could there be something non-linear in the length of the file?Currently it's under 500k:
To Reproduce
Steps to reproduce the behaviour.
Output:
Expected behaviour
A clear and concise description of what you expected to happen.
By comparison, doing the same thing with
js-yaml
takes only:Output:
Versions (please complete the following information):
yaml
: 2.4.1Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: