- Add $json->encode_to($fh, $data, [$type]) to stream encoded JSON directly
to a filehandle instead of building the whole result in memory
(GH #250, requested by yairlenga. designed 2016 in GH #58).
Internally flushes a bounded 8k chunk buffer as it fills, keeping
peak memory bounded for large data structures.
- Encoder performance improvements suggested in GH #237 (17dec):
- Large-integer encoding now uses a 100-digit lookup table instead of
snprintf, roughly 2x faster for integers outside the existing
branchless small-integer fast path (|value| > 59000).
- encode_str now bulk-copies runs of consecutive bytes that need no
escaping instead of a need()+store per byte, notably faster for
strings with few or no characters to escape.
- Large-integer encoding now uses a 100-digit lookup table instead of