github stephenberry/glaze v2.6.0
2.6.0

latest releases: v9.0.0, v8.4.0, v8.3.0...
2 years ago

Major Update

Potentially breaking binary (BEVE) read changes

The binary error checking is becoming much more robust, with the intent to make it completely safe for untrusted inputs. Currently many, but not all, input errors are handled, so binary should only be used in trusted contexts, where the developer is handling both encoding and decoding.

Important

This update requires BEVE input buffers to be null terminated. Just like Glaze requires null termination for JSON input buffers.

  • Allows fast validation
  • Allows common buffer handling between binary and JSON

If you were using std::vector<std::byte> for your binary input buffer, simply append a null character to your buffer before reading.

It is recommended to use a std::string for binary reading, as std::string ensure null termination.

Padding for Mutable Input Buffers

When non-const (mutable) input buffers are passed in (e.g. std::string versus const std::string), Glaze now temporarily adds padding to improve SIMD performance and reduce assembly.

This is not a breaking change. It is simply recommended to pass mutable input buffers into read calls.

The buffer is padded with null bytes while reading and then reverted at the end of the function call. Glaze does not permanently change your input buffer.

  • This change reduces the produced assembly, so the overall program binary will be reduced when using mutable input buffers.

Improvements

  • Faster glz::minify_json
  • Faster string reading for escaped inputs
  • Faster unknown key discover in some cases
  • More specific error handling for commas, colons, and quotes

minfied Compile Time Option

If you wish to require minified JSON or know your input will always be minified, then you can gain a little more performance by using the compile time option .minified = true.

auto ec = glz::read<glz::opts{.minified = true}>(obj, buffer);

Fixes

  • Proper tab usage in glz::prettify_json
  • Using full 256 byte tables for safely handling invalid JSON

Removed Deprecations

  • Removed the deprecated macros.hpp header
  • Removed the deprecated glz::prettify and glz::minify functions. Use the new glz::prettify_json and glz::minify_json

Full Changelog: v2.5.5...v2.6.0

Don't miss a new glaze release

NewReleases is sending notifications on new releases.