)]}'
{
  "commit": "9ea2d28ef91d5d266aad5f269eacd04c69b34587",
  "tree": "e74c6d28d92cd0ad65a815683db38634940258dc",
  "parents": [
    "ac6b505923c2a495837d32efa9038b01b14f9a6b"
  ],
  "author": {
    "name": "Niels Lohmann",
    "email": "mail@nlohmann.me",
    "time": "Wed Jul 22 10:59:50 2026 +0000"
  },
  "committer": {
    "name": "Niels Lohmann",
    "email": "mail@nlohmann.me",
    "time": "Wed Jul 22 11:01:03 2026 +0000"
  },
  "message": "Reserve output capacity up front for binary serialization\n\nThe vector-returning to_cbor/to_msgpack/to_ubjson/to_bjdata/to_bson grew\nthe output buffer purely by geometric reallocation. Reserving an estimate\nup front avoids the early reallocations, which is the dominant per-byte\ncost for array/object-heavy output.\n\nThe estimate (binary_reserve_hint) is deliberately conservative and safe\nagainst untrusted input: it consults only the top-level element count\n(O(1), no walk of the DOM), guards the multiplication against overflow,\nand clamps the result to a fixed 1 MiB ceiling, so a large or hostile DOM\ncan never force an oversized allocation here. The buffer still grows\ngeometrically past the hint, so an underestimate only costs a few later\nreallocations; scalars/strings/binary are written in one shot and get no\nhint. Reserving capacity does not change the bytes produced.\n\nThroughput (g++/clang -O3, vs the previous commit):\n  cbor int array     +10% / +13%\n  cbor object array  +20% / +38%\n\nOutput is byte-for-byte identical to develop across the binary\ndifferential corpus.\n\nCo-Authored-By: Claude Opus 4.8 \u003cnoreply@anthropic.com\u003e\nClaude-Session: https://claude.ai/code/session_01XAYM1qhSA2FDaDcGfPW3fG\nSigned-off-by: Niels Lohmann \u003cmail@nlohmann.me\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4e2747169a749a8bedd09a41e631d81fecb543b0",
      "old_mode": 33188,
      "old_path": "include/nlohmann/detail/output/binary_writer.hpp",
      "new_id": "fe97dc2a4a84b11374f054f203809cff45cc6db0",
      "new_mode": 33188,
      "new_path": "include/nlohmann/detail/output/binary_writer.hpp"
    },
    {
      "type": "modify",
      "old_id": "551bcdee84dc0c12c9460699dfd7814133a3a9eb",
      "old_mode": 33188,
      "old_path": "include/nlohmann/json.hpp",
      "new_id": "1eeac5085cc375f76e840a4c00df513a7706458c",
      "new_mode": 33188,
      "new_path": "include/nlohmann/json.hpp"
    },
    {
      "type": "modify",
      "old_id": "cfffde13d7e7fb4a63ebbbd5bf5449689b872eda",
      "old_mode": 33188,
      "old_path": "single_include/nlohmann/json.hpp",
      "new_id": "6cfdbfc57d8f9f531dd6f354cc687b8a07a8ca57",
      "new_mode": 33188,
      "new_path": "single_include/nlohmann/json.hpp"
    }
  ]
}
