The bulk is a JSON array of more than a million objects; parsing it
in one call holds the whole decoded tree in memory, which is what
exhausted the stress-test runners. This reader walks the file in
fixed-size byte chunks and emits the array in batches of
batch_size complete top-level objects, each as its own JSON array
text, so the caller parses one batch at a time. Object boundaries
are found with a vectorised scan: unescaped quotes delimit string
literals, braces outside them change the depth, and an object ends
where the depth returns to zero. Nothing beyond n_max objects is
read, so a sample of a 200 MB bulk costs a few megabytes. The batch
size bounds the transient the JSON decoder needs: 5,000 objects keep
it near 1 GB where 25,000 took 1.7 GB, at the same speed.