v4.2.0
Breaking Partial Read Changes (Faster/Cleaner)
- The option
partial_read_nested
has been removed, to simplify partial reading and bring better performance. If the optionpartial_read
istrue
, then short circuiting will occur after the deepest value is read. This ensures that a true "partial" read occurs and post-read skipping is not necessary.- If you only want to read certain fields in a struct and perform this multiple times within a larger object, then use
glz::skip
or seterror_on_unknown_keys = false
. Either of these approaches will skip keys you don't care about.
- If you only want to read certain fields in a struct and perform this multiple times within a larger object, then use
- The local metadata for
static constexpr auto partial_read = true;
will now be ignored. You must explicitly useglz::opts{.partial_read = true}
in the Glaze options for partial reading.- The local meta parameter was a poor design choice, because we want to separate serialization logic from options, so that the same
glz::meta
information can be used with various options. It also complicated the code/API.
- The local meta parameter was a poor design choice, because we want to separate serialization logic from options, so that the same
Tip
When setting up partial reading, it is best to just include the parts of the deepest structure you care about and the parent structures to that location. This ensures the most efficient traversal to the fields of interest and the least amount of C++ struct writing.
The documentation for partial reading has been updated here: [Partial Read](https://github.com/stephenberry/glaze/blob/main/docs/partial-read.md)
by @stephenberry in #1502
Improvements
- Faster string skipping with SWAR in #1499
Full Changelog: v4.1.0...v4.2.0