ingokegel opened a new pull request, #4012: URL: https://github.com/apache/fory/pull/4012
## Why? Closes #4011. JSON has no binary type. The ecosystem standard for byte arrays in JSON is a base64 string (see RFC 7493, the protobuf JSON mapping, Jackson, Gson, Moshi, kotlinx.serialization). Fory JSON currently writes byte[] as a JSON array of decimal numbers, which is about 2.1x larger on the wire and about 4.5x slower to write and read on binary-heavy payloads. ## What does this PR do? - Makes Base64ByteArrayCodec the default codec for byte[], previously opt-in via @JsonBase64. The annotation still works and is now redundant. - Speeds up Base64 reading: a single table-driven validation scan and a table-driven quad decode replace the two-pass decode. - readBase64 now reserves the decoded array in the graph memory budget, like other array reads. - Tests updated to the base64 default ## Related issues Closes #4011 ## AI Contribution Checklist - [ no] Substantial AI assistance was used in this PR: `yes` / `no` - [ ] If `yes`, I included a completed [AI Contribution Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs) in this PR description and the required `AI Usage Disclosure`. - [ ] If `yes`, my PR description includes the required `ai_review` summary and screenshot evidence or equivalent persisted links of the final clean AI review results from both fresh reviewers described in `AI_POLICY.md`, the Fory-guided reviewer and the independent general reviewer, on the current PR diff or current HEAD after the latest code changes. ## Does this PR introduce any user-facing change? - [ ] Does this PR introduce any public API change? - [x ] Does this PR introduce any binary protocol compatibility change? ## Benchmark Round trip on a realistic payload with ~5 KB byte[] thumbnails, 2M iterations, JDK 25, Linux x86_64, project: https://github.com/ej-technologies/serialization-comparison | | ns/op | avg bytes | | ----------------------- | -------: | ---------: | | Fory JSON 1.7.0 | 75936 | 20999 | | this PR | 16769 | 9742 | | Jackson JSON | 27036 | 9814 | -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
