)]}'
{
  "commit": "3f14362959d5260e58733b53ff7deb3cfe42398d",
  "tree": "0a4a6ff1e4291382e4883006bc5536cc940abd6a",
  "parents": [
    "322063822f66533bb81ef8e938fd07e5f6394917"
  ],
  "author": {
    "name": "Niels Lohmann",
    "email": "mail@nlohmann.me",
    "time": "Thu Nov 26 00:28:16 2026 +0100"
  },
  "committer": {
    "name": "Niels Lohmann",
    "email": "mail@nlohmann.me",
    "time": "Thu Nov 26 01:20:16 2026 +0100"
  },
  "message": "Keep GCC from expanding put_string\u0027s memcpy into rep movsq\n\nput_string() tests the run length against the size of the write buffer\nbefore copying it there, so GCC knows the memcpy length is below 1024. With\n-march\u003dx86-64-v3 (the default of Ubuntu 26.04\u0027s GCC on CPUs that support it)\nand -mtune\u003dgeneric, it then expands the memcpy inline into \"rep movsq\"\ninstead of calling memcpy. The start-up cost of rep movsq is far above that\nof the call for the runs of a few dozen bytes the serializer writes; it hit\ndump() with ensure_ascii, where the copy sits in dump_escaped_impl\u003ctrue\u003e.\n\nAn empty asm statement now hides the bound from GCC\u0027s optimizer, so the\ncopy stays a call to memcpy. Clang is not affected and does not see the\nstatement.\n\ndump() with ensure_ascii, GCC 15.2 -O3 -march\u003dx86-64-v3, Sapphire Rapids\n(c7i.2xlarge), median of 5 interleaved rounds: github_events -40.7 %,\nsemanticscholar -12.2 %, gsoc-2018 -10.8 %, update-center -7.7 %, twitter\n-4.8 %. Aligned builds (-falign-loops\u003d64 -falign-functions\u003d64) agree. All\nother rows (ensure_ascii\u003dfalse, baseline x86-64, Clang) are within noise;\noutside dump_escaped_impl\u003ctrue\u003e the generated code differs only in register\nallocation.\n\nSigned-off-by: Niels Lohmann \u003cmail@nlohmann.me\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e0562c8bdbd5ada77b899c34719728af171258bb",
      "old_mode": 33188,
      "old_path": "include/nlohmann/detail/output/serializer.hpp",
      "new_id": "4e80185a4d62598ad1dd4b6b22a7c96fe03a79bd",
      "new_mode": 33188,
      "new_path": "include/nlohmann/detail/output/serializer.hpp"
    },
    {
      "type": "modify",
      "old_id": "44a5b6cd1db580178eb9fa1ed4069dadc688045e",
      "old_mode": 33188,
      "old_path": "single_include/nlohmann/json.hpp",
      "new_id": "25e7579348c21ec4ffe7760cdafe951d57f6286a",
      "new_mode": 33188,
      "new_path": "single_include/nlohmann/json.hpp"
    }
  ]
}
