I'm proposing for Node.js to expose the existing [simdjson]((https://github.com/simdjson/simdjson) integration through an experimental flag or via node:simdjson to enable those who want to use it without brower compatibility concern.
Background
Node.js currently includes simdjson internally but doesn't expose it to userland code AFAIU. During a recent discussion with @RafaelGSS on his livestream, it was mentioned that simdjson isn't enabled yet primarily due to insufficient testing to demonstrate API compatibility with browser JSON APIs.
Motivation
- Performance: simdjson offers significant parsing performance improvements over the standard JSON parser
- Community Testing: Exposing it experimentally would allow the community to extensively test compatibility
- Feedback Loop: Early access would help identify compatibility issues and API design concerns
- Innovation: Enables developers to experiment with high-performance JSON parsing in Node.js applications
Proposed Solution
Expose simdjson through one of these approaches:
Option 1: Experimental Flag
node --experimental-simdjson app.js
This would make simdjson available globally, potentially replacing or augmenting the standard JSON object.
Option 2: Dedicated Module
import { parse, stringify } from 'node:simdjson';
// or
const { parse, stringify } = require('node:simdjson');
Option 3: Hybrid Approach
Enable both the experimental flag and module access, allowing for different testing scenarios.
API Considerations
The exposed API may aim for compatibility (if desired) with:
- Standard
JSON.parse() and JSON.stringify() signatures
- Browser JSON API behavior and edge cases
- Error handling patterns consistent with existing Node.js APIs
Implementation Considerations
- Mark the API as experimental with appropriate warnings
- Document known limitations or differences from standard JSON
- Provide clear migration path for when/if the API becomes stable
- Consider feature detection mechanisms for applications
I'd love to try out simdjson in my apps instead of the V8 JSON functions.
An experimental exposure could provide valuable data on real-world compatibility and performance, helping to make an informed decision about full integration while giving the community access to simdjson's performance benefits.
I'm proposing for Node.js to expose the existing [simdjson]((https://github.com/simdjson/simdjson) integration through an experimental flag or via
node:simdjsonto enable those who want to use it without brower compatibility concern.Background
Node.js currently includes simdjson internally but doesn't expose it to userland code AFAIU. During a recent discussion with @RafaelGSS on his livestream, it was mentioned that simdjson isn't enabled yet primarily due to insufficient testing to demonstrate API compatibility with browser JSON APIs.
Motivation
Proposed Solution
Expose simdjson through one of these approaches:
Option 1: Experimental Flag
This would make simdjson available globally, potentially replacing or augmenting the standard
JSONobject.Option 2: Dedicated Module
Option 3: Hybrid Approach
Enable both the experimental flag and module access, allowing for different testing scenarios.
API Considerations
The exposed API may aim for compatibility (if desired) with:
JSON.parse()andJSON.stringify()signaturesImplementation Considerations
I'd love to try out simdjson in my apps instead of the V8 JSON functions.
An experimental exposure could provide valuable data on real-world compatibility and performance, helping to make an informed decision about full integration while giving the community access to simdjson's performance benefits.