)]}'
{
  "commit": "70301da7c7ea0678b72cd25ed869b023547e15cb",
  "tree": "687facca58027662daa931aaf3caf0966d1c82a6",
  "parents": [
    "a7ad680269cc250d87f584ce84c40f7f90dc7159",
    "f041962694875c0f0a33f8a5e27fd00597042169"
  ],
  "author": {
    "name": "Jakub Beránek",
    "email": "berykubik@gmail.com",
    "time": "Mon Jul 14 11:04:55 2025 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Jul 14 11:04:55 2025 +0200"
  },
  "message": "Rollup merge of #143881 - orlp:once-state-repr, r\u003dtgross35\n\nUse zero for initialized Once state\n\nBy re-labeling which integer represents which internal state for `Once` we can ensure that the initialized state is the all-zero state. This is beneficial because some CPU architectures (such as Arm) have specialized instructions to specifically branch on non-zero, and checking for the initialized state is by far the most important operation.\n\nAs an example, take this:\n\n```rust\nuse std::sync::atomic::{AtomicU32, Ordering};\n\nconst INIT: u32 \u003d 3;\n\n#[inline(never)]\n#[cold]\npub fn slow(state: \u0026AtomicU32) {\n    state.store(INIT, Ordering::Release);\n}\n\npub fn ensure_init(state: \u0026AtomicU32) {\n    if state.load(Ordering::Acquire) !\u003d INIT {\n        slow(state)\n    }\n}\n```\n\nIf `INIT` is 3 (as is currently the state for `Once`), we see the following assembly on `aarch64-apple-darwin`:\n\n```asm\nexample::ensure_init::h332061368366e313:\n        ldapr   w8, [x0]\n        cmp     w8, #3\n        b.ne    LBB1_2\n        ret\nLBB1_2:\n        b       example::slow::ha042bd6a4f33724e\n```\n\nBy changing the `INIT` state to zero we get the following:\n\n```asm\nexample::ensure_init::h332061368366e313:\n        ldapr   w8, [x0]\n        cbnz    w8, LBB1_2\n        ret\nLBB1_2:\n        b       example::slow::ha042bd6a4f33724e\n```\n\nSo this PR saves 1 instruction every time a `LazyLock` gets accessed on platforms such as these.\n",
  "tree_diff": []
}
