ATProto Browser

ATProto Browser

Experimental browser for the Atmosphere

Post

This is mostly an issue with large nested dictionaries, but two things are your friend: Subscript with default: dict[x, default: []].append(y) Optional.take, which removes the item and leaves you with 1 reference (no COW) var items = dict[x].take() ?? [] doABunchOfStuff(&items) dict[x] = items

May 8, 2025, 1:54 PM

Record data

{
  "uri": "at://did:plc:rtcmfdskwc7kfc3bgnwbpqxq/app.bsky.feed.post/3loo2rrz5d22a",
  "cid": "bafyreidnhzdiasocst7hy7fompa7oz2atrptnz7qq52e2berh6mk27hjxy",
  "value": {
    "text": "This is mostly an issue with large nested dictionaries, but two things are your friend:\n\nSubscript with default:\ndict[x, default: []].append(y)\n\nOptional.take, which removes the item and leaves you with 1 reference (no COW)\n\nvar items = dict[x].take() ?? []\ndoABunchOfStuff(&items)\ndict[x] = items",
    "$type": "app.bsky.feed.post",
    "langs": [
      "en"
    ],
    "reply": {
      "root": {
        "cid": "bafyreiha2irgby3apggdsei5ylvoob5n5x5u6fnipgyun7xxlltvorkwrq",
        "uri": "at://did:plc:rtcmfdskwc7kfc3bgnwbpqxq/app.bsky.feed.post/3loo2izhsvs2a"
      },
      "parent": {
        "cid": "bafyreiha2irgby3apggdsei5ylvoob5n5x5u6fnipgyun7xxlltvorkwrq",
        "uri": "at://did:plc:rtcmfdskwc7kfc3bgnwbpqxq/app.bsky.feed.post/3loo2izhsvs2a"
      }
    },
    "createdAt": "2025-05-08T13:54:16.564Z"
  }
}