feat(core): faster YAML and JSON parser #299
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Replace the yaml library with js-yaml, which provides at least an order of magnitude performance improvement.
(2.85MB document, 1.3s => 0.19s)
We now explicitly provide JSON input support.
We used to use the yaml to provide fallback handling for JSON, but it was very slow. Now we've moved to using nodejs' built-in
JSON.parse
function, which uses the simdjson library under the hood. It's two orders of magnitude faster than using yaml's fallback strategy for JSON.(2.39MB document, 1.17s => 0.03s)
To benefit from faster JSON parsing, you need to specify files with a
.json
extension. Files parsed with other extensions still use the fallback strategy of the js-yaml library.Checklist