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

[Enhancement] Improve the parser performances #162

Closed
arcanis opened this issue May 14, 2019 · 1 comment
Closed

[Enhancement] Improve the parser performances #162

arcanis opened this issue May 14, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@arcanis
Copy link
Member

arcanis commented May 14, 2019

Context

We parse the lockfiles using a format managed by the @berry/parsers package (we call it syml, for Simpler Yaml). The idea was that since we didn't need the whole power of yaml, a smaller parser should theoretically be faster.

Well, as it turns out, it's not so simple. Our current parsing time (based on a peg.js-generated parser) is ~180ms for the Berry lockfile. In contrast, using js-yaml brought the parsing time to ~60ms.

It's very likely that I made the peg grammar non-optimal, so if someone wants to take a shot at optimizing it (or rewriting it with another tool like chevrotain, for example) it would be helpful. If we can't make it faster, I guess we'll switch to js-yaml.

Describe alternatives you've considered

We could also switch to js-yaml without looking back. That would be ok for me, but we will first have to check how much it adds/removes to the bundle size. Note that if we do that we'll still need to keep the peg parser in our tree as a fallback at least until the 3.0 (otherwise we wouldn't be able to support old-style lockfiles, which would be bad for the migration story).

@arcanis arcanis added the enhancement New feature or request label May 14, 2019
@arcanis
Copy link
Member Author

arcanis commented Jun 24, 2019

Implemented in #183

@arcanis arcanis closed this as completed Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant