-
Notifications
You must be signed in to change notification settings - Fork 6
Use simd-json value parsing without serde_impl #111
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates from serde_json to simd_json for JSON parsing, specifically avoiding the serde_impl feature by implementing manual value conversions. The change removes the dependency on serde-based deserialization and instead uses simd_json::OwnedValue with custom parsing logic.
Key Changes:
- Replaced
serde_jsonwithsimd-jsonusing only thevaluefeature (withoutserde_impl) - Implemented manual JSON object parsing for
TsConfigandPackageJsoninstead of serde deserialization - Updated all test fixtures to use
simd_json::json!macro and serialization helpers
Reviewed Changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Updated dependency from serde_json to simd-json with custom patch configuration |
| src/tsconfig.rs | Replaced serde deserialization with manual simd_json::OwnedValue parsing helpers |
| src/package_json.rs | Changed signature to accept mutable string slice for in-place parsing |
| src/cache.rs | Updated error handling and function calls to use simd_json types |
| src/error.rs | Renamed helper function and updated documentation references |
| src/lib.rs | Changed JSONValue type alias to simd_json::OwnedValue |
| src/tests/tsconfig_paths.rs | Converted test fixtures to use simd_json serialization |
| src/tests/imports_field.rs | Simplified helper to directly extract object from value |
| src/tests/exports_field.rs | Updated type signatures to use simd_json::OwnedValue |
| benches/resolver.rs | Updated benchmark to use mutable string for parsing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Cargo.toml
Outdated
| debug = false# set to `true` for debug information | ||
| panic = "abort" | ||
| [patch.crates-io] | ||
| simd-json = { path = "vendor/simd-json" } |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch configuration references a local vendor path that likely doesn't exist in the repository. This will cause build failures for other developers or CI systems. Consider either: (1) removing this patch if it was used only for local development, or (2) documenting the vendor directory requirement in the PR description or README.
| simd-json = { path = "vendor/simd-json" } |
| json: &str, | ||
| ) -> Result<Self, serde_json::Error> { | ||
| let mut raw_json: JSONValue = serde_json::from_str(json)?; | ||
| json: &mut str, |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the parameter from &str to &mut str is a breaking API change that may affect external callers. The mutability requirement comes from simd_json::to_owned_value modifying the input string for performance. Consider documenting this requirement in the function's documentation comment, explaining that the input string will be modified during parsing.
CodSpeed Performance ReportMerging #111 will not alter performanceComparing Summary
|
Summary
simd-jsonvalue implementation and helper macros that avoid theserde_implfeaturesimd_json::serdemoduleTesting
https://chatgpt.com/codex/tasks/task_e_68f5a951159c8326a66ea2760df20dbf