)]}'
{
  "commit": "1d51b00830dd1b60d0e1df5bdebe283bbc332d25",
  "tree": "730cc1639c20c967fa7867aeabd841b25f4276f8",
  "parents": [
    "09e5e85ba59f0f10a32a91bba8396054ee55f364"
  ],
  "author": {
    "name": "Niels Lohmann",
    "email": "mail@nlohmann.me",
    "time": "Wed Jul 22 10:59:50 2026 +0000"
  },
  "committer": {
    "name": "Claude",
    "email": "noreply@anthropic.com",
    "time": "Mon Aug 31 23:21:45 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": "306506801e55e30e391a6a03e0235e54a247dc8c",
      "old_mode": 33188,
      "old_path": "include/nlohmann/detail/output/binary_writer.hpp",
      "new_id": "27122a26b48e4cbc9f52326102507ea3ba87b22b",
      "new_mode": 33188,
      "new_path": "include/nlohmann/detail/output/binary_writer.hpp"
    },
    {
      "type": "modify",
      "old_id": "7eac69de2b0d9c86a28496ab395d64672b653c10",
      "old_mode": 33188,
      "old_path": "include/nlohmann/json.hpp",
      "new_id": "002399bc026044fb047f052159e33b51b0380390",
      "new_mode": 33188,
      "new_path": "include/nlohmann/json.hpp"
    },
    {
      "type": "modify",
      "old_id": "fc2ac9811cc8bdb0d8e50ba21b282a5cbc15f236",
      "old_mode": 33188,
      "old_path": "single_include/nlohmann/json.hpp",
      "new_id": "c9cbb9809b6b9353956a0e36eeae0473bb3777b1",
      "new_mode": 33188,
      "new_path": "single_include/nlohmann/json.hpp"
    }
  ]
}
