simdjson_php
simdjson_php copied to clipboard
simdjson_php bindings for the simdjson project. https://github.com/lemire/simdjson
Related to #65 `simdjson_is_valid(): bool` and other PHP bindings would unpredictably be false if the OS was out of memory E.g. use zend_error_noreturn to terminate the process
https://github.com/simdjson/simdjson/blob/master/doc/dom.md#reusing-the-parser-for-maximum-efficiency > If you're using simdjson to parse multiple documents, or in a loop, you should make a parser once and reuse it. The simdjson library will allocate and retain...
- Support distinguishing between object/array/null - simdjson_key_count returns 0 for non-objects/non-arrays E.g. return an array with fields type and count or null if the key does not exist
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...
This may be useful if applications parse megabytes of json on startup, but don't use simdjson for large requests later on. This would free the buffers used by the underlying...
- This would allow performance monitoring tools to properly indicate how much memory simdjson uses during a request - This would respect `memory_limit` settings in a conventional way and properly...
Idea: Throw SimdJsonException for a far lower user-provided max depth, in a subsequent major release
C programs usually have a small stack size by default, and https://www.php.net/fiber is also low for the few use cases of fibers Applications that override $depth in simdjson_decode to a...
(instead of throwing SimdJsonException for the capacity error) simdjson_decode is meant to have indistinguishable behavior from json_decode apart from error codes/classes/messages, so this should be safe - Use the JsonException...
Can you adjust the decoder to read faster, probably 4bit is a lot faster then the default 64bit, so we can choose the datatype. For computation of embeddings for example,...
Hello, Thank you for the great extension. Would it be possible to have a flag for simdjson_key_value() that would return the JSON string, instead of decoding it first? Sort of...