simdjson_php
simdjson_php copied to clipboard
Limit worst-case memory for string/depth buffers after simdjson call completes
E.g. if there's a long-running CLI application that calls simdjson_decode()
once on startup, for a 100 megabyte long string, then avoid keeping around the 100 megabyte buffer that was allocated for the C simdjson parser after it is finished being used.
This would make it easier to reason about the worst-case impact of simdjson on PHP's memory usage.
If a buffer would be longer than a certain threshold (e.g. 100KB), then use a different short-lived instance (so that the same parser/buffer can be reused when calling simdjson again on small json blobs)