streaming-huge-json: 1 GiB streaming vs tree vs binding benchmark (Jackson 3.2.4, JDK 25) for the rewritten streaming post
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# streaming-huge-json
|
||||
|
||||
Companion code for the rewritten post
|
||||
[Jackson Streaming API and JsonNode (Jackson 3)](https://ankurm.com/jackson-streaming-api-jsonnode/).
|
||||
|
||||
A self-contained Maven module (not part of the root build). It generates a 1 GiB JSON array,
|
||||
then counts the `ERROR` records four ways under fixed `-Xmx` limits.
|
||||
|
||||
```
|
||||
Jackson 3.2.4 (tools.jackson.core:jackson-databind, GA on Maven Central 2026-10-18)
|
||||
JDK Temurin 25.0.5 (LTS)
|
||||
```
|
||||
|
||||
| Class | What it shows |
|
||||
|---|---|
|
||||
| [`GenerateHugeJson`](src/main/java/com/ankurm/jackson3/streaminghuge/GenerateHugeJson.java) | Writing 1 GiB with `JsonGenerator` under `-Xmx64m` |
|
||||
| [`Scan`](src/main/java/com/ankurm/jackson3/streaminghuge/Scan.java) | `stream`, `hybrid`, `tree`, `bind` (and the broken `hybrid-naive`) |
|
||||
| [`NestedTrap`](src/main/java/com/ankurm/jackson3/streaminghuge/NestedTrap.java) | The flat-object loop breaking on nested JSON; `skipChildren()` fix |
|
||||
| [`TruncatedFile`](src/main/java/com/ankurm/jackson3/streaminghuge/TruncatedFile.java) | What a cut-off file does to streaming vs tree |
|
||||
| [`ReadLimits`](src/main/java/com/ankurm/jackson3/streaminghuge/ReadLimits.java) | Default `StreamReadConstraints` values |
|
||||
|
||||
```bash
|
||||
cd streaming-huge-json
|
||||
./scripts/run-all.sh --quick # small demos only
|
||||
./scripts/run-all.sh # also generates target/huge.json (1 GiB, git-ignored) and runs the ladder
|
||||
```
|
||||
|
||||
Captured output is in [`output/`](output). Memory figures are from one run on a 2-CPU, 8 GB
|
||||
container; `peakUsed` is sampled `total - free` heap and includes garbage not yet collected.
|
||||
Timings vary between runs; the pass/fail pattern per `-Xmx` is the stable part.
|
||||
|
||||
Note on `output/bench.txt`: the `tree -Xmx= 6144 MB KILLED` line comes from a separate manual run
|
||||
(the first ladder run printed a blank line for it because the OS killed the JVM, exit 137);
|
||||
`scripts/bench.sh` now records that case itself.
|
||||
Reference in New Issue
Block a user