This commit introduces several improvements for JSON. Namely:
Usage of SIMD JSON in order to speed up JSON.parse and using serde_json in order to speed up JSON.stringify.
Introduction of Javy.JSON functions as helpers to work with the stdin and stdout file descriptors. These are non-standard and live at the Javy namespace for that reason. These APIs should be considered unstable, meaning that there's no guarantee that they'll live in-tree forever, the intention is to move these away once our extensibility story is polished.
--
The usage of the more performant JSON functions (based on SIMD and serde_json) requires enabling the QuickJS JSON intrinsic (see the config.rs module). The reason behind this decision is to enable: a compliant JSON implementation that is optimized for the hotpath: if extra arguments are passed to either JSON.{parse,stringify}, the native parse/stringify functions will be invoked, keeping the standard functionality.
I believe that the best way to test this would be to run JSON 262 tests, to ensure that the implementation is fully compliant. However, this is not included in this PR. Such change is better packed on its own pull-request. I'll follow up with a change that includes a way to run JSON 262 tests.
Checklist
[x] I've updated the relevant CHANGELOG files if necessary. Changes to javy-cli and javy-core do not require updating CHANGELOG files.
Description of the change
This commit introduces several improvements for JSON. Namely:
JSON.parse
and usingserde_json
in order to speed upJSON.stringify
.Javy.JSON
functions as helpers to work with the stdin and stdout file descriptors. These are non-standard and live at theJavy
namespace for that reason. These APIs should be considered unstable, meaning that there's no guarantee that they'll live in-tree forever, the intention is to move these away once our extensibility story is polished.--
The usage of the more performant JSON functions (based on SIMD and serde_json) requires enabling the QuickJS JSON intrinsic (see the config.rs module). The reason behind this decision is to enable: a compliant JSON implementation that is optimized for the hotpath: if extra arguments are passed to either JSON.{parse,stringify}, the native parse/stringify functions will be invoked, keeping the standard functionality.
I believe that the best way to test this would be to run JSON 262 tests, to ensure that the implementation is fully compliant. However, this is not included in this PR. Such change is better packed on its own pull-request. I'll follow up with a change that includes a way to run JSON 262 tests.
Checklist
javy-cli
andjavy-core
do not require updating CHANGELOG files.