The GitHub Actions job "go_modules in /integration_tests/grpc_tests/go for 
google.golang.org/grpc - Update #1551790286" on fory.git/main has failed.
Run started by GitHub user dependabot[bot] (triggered by dependabot[bot]).

Head commit for run:
379067682d58ca80a27d6cefdfcc43234d32ec8d / Ingo Kegel 
<[email protected]>
feat(json): encode byte arrays as base64 JSON strings by default (#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        |

---------

Co-authored-by: chaokunyang <[email protected]>

Report URL: https://github.com/apache/fory/actions/runs/33609996481

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to