You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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).The text was updated successfully, but these errors were encountered: