)]}'
{
  "commit": "70452eb388c0557d896f5c1ca1f6c995b8e98492",
  "tree": "0ef59c7b7bc8204d2f17f275a21797fe931cfa81",
  "parents": [
    "60e398ba2d47f5278acd078535c8780e99bc9f74"
  ],
  "author": {
    "name": "hernan",
    "email": "hernan@rive.app",
    "time": "Tue Nov 03 17:38:38 2026 -0800"
  },
  "committer": {
    "name": "hernan",
    "email": "hernan@rive.app",
    "time": "Tue Nov 03 17:38:38 2026 -0800"
  },
  "message": "perf(runtime): build and sync layouts with fewer allocations (#15378)\n\n* fix(runtime): list a layout\u0027s style among its children once\n\nA layout\u0027s style names the layout as its parent, so the style\u0027s own\nonAddedDirty already adds it to the layout\u0027s children. The layout\u0027s\nonAddedDirty then added it again, so the runtime listed every layout\u0027s\nstyle twice and every walk over a layout\u0027s children visited it twice.\nThe editor build dedupes children, so it never showed. The layout now\nadds the style only when the style is parented somewhere else.\n\nIn the HUD perf tray, 359 of the 3,227 children added at load were\nthese duplicates, and an added leaderboard row makes 2 fewer\nallocations.\n\nTwo state machine tests picked shapes by their position among the\nartboard\u0027s children, a count that included the duplicate; they now find\nthe shapes by name. The test that an instance\u0027s child list is sized\nexactly used a row whose three children counted the duplicate, so it now\nuses a row that still has three.\n\n* perf(runtime): keep a layout item\u0027s style appliers inline\n\nEvery layout item lists the objects that apply its style: the item\nitself, its style and, under a grid, its placement. The list was a lazy\nheap vector, so a layout component allocated the vector, then a buffer\nfor one applier, then grew it for the second and again for a placement.\nThe first three appliers now live inline in LayoutData, and only a\nfourth moves the list to the heap.\n\nLayoutData grows from 728 to 752 bytes, and each layout item drops a\nvector and its buffer from the heap (48 to 64 bytes). In the HUD perf\ntray, an added leaderboard row makes 18 fewer allocations.\n\n* perf(runtime): leave Yoga\u0027s grid properties unallocated on flex layouts\n\nYoga keeps a node\u0027s grid tracks and lines in a box it allocates on the\nfirst write, so a node that isn\u0027t a grid never pays for them. Every\nlayout that isn\u0027t a stack still wrote its four track lists on each style\nsync, empty or not, which allocated that box for every flex layout. The\nlists are now written only when the layout has tracks, or old ones to\nclear.\n\nIn the HUD perf tray, an added leaderboard row makes 5 fewer allocations,\nand each flex layout drops its unused grid box from the heap.\n\n* perf(runtime): size a layout\u0027s background path once\n\nPath::addRoundedRect built a layout\u0027s background a verb and a point at a\ntime, so its arrays grew several times on the first build. It now\nreserves the outline\u0027s exact size first: a move, four lines and a close,\nplus a cubic for each rounded corner.\n\nIn the HUD perf tray, an added leaderboard row makes 6 fewer\nallocations.\n\n* perf(runtime): list an artboard\u0027s dirty layouts in a vector\n\nAn artboard kept the layouts whose style changed in an unordered_set, so\nmarking a layout allocated a node, and a busy set its buckets too. They\nare now a vector in the order they were marked, and each layout says it\nis listed: a layout in a spare bit of its flags, and an artboard listed\nby its host in a bool, since an artboard can be listed by its host and by\nitself at once. Both sit in existing padding, and Artboard shrinks from\n1096 to 1080 bytes.\n\nAn artboard now leaves its own and its host\u0027s lists in ~Artboard, while\nit is still whole. ~LayoutComponent used to do that for it, after\nArtboard\u0027s members, the list among them, were already destroyed. An\nartboard moving to another host also leaves the old host\u0027s list.\n\nThe editor moves a component to another artboard by setting its artboard\ndirectly, and clears it that way before it frees or orphans one. A layout\nmoving that way leaves the old artboard\u0027s list first, and so do the\nartboards a host moving that way lays out, a list\u0027s pooled rows among\nthem. Otherwise a moved one\u0027s flag would stay set, so the new artboard\nwould never list it, and a freed one would stay listed for the next sync\nto read. Deleting a listed layout in the editor did that before this\nchange too: its destructor leaves the list through its artboard, which\nthe editor had already cleared.\n\nIn the HUD perf tray, an added leaderboard row makes 4 fewer allocations.\n\n* perf(runtime): keep Yoga\u0027s child list when a layout\u0027s children didn\u0027t change\n\nsyncLayoutChildren removed every child from the layout\u0027s Yoga node,\nwhich also freed the node\u0027s child list, and then added the children back\none at a time, growing a fresh list and a scratch list on every sync. A\nsync now collects the children first, into a scratch list sized for the\nones the node had. When they are the same children in the same order, it\nresets them as removing and adding them again would and keeps Yoga\u0027s\nlist as it is.\n\nThe children\u0027s layouts are still reset and the node is still marked\ndirty, so a layout solves exactly as before.\n\nIn the HUD perf tray, an added leaderboard row makes 3 fewer\nallocations, all in the root re-sync that hosting the row does.\n\n* perf(runtime): host list rows without syncing the host\u0027s root layout\n\nHosting an artboard that shares its host\u0027s layout synced the layout\nchildren of the artboard holding the host, its root, once per artboard.\nA component list syncs its own layout parent once its rows are in place,\nwhich is the layout that actually holds them and may not be the root, so\nadding N rows synced the root N times for nothing: each sync collected\nthe root\u0027s children again and reset their Yoga layouts. A host now says\nwhether it syncs its layout parent itself, and the list does.\n\nNested artboard layouts still sync the root when they mount an artboard.\n\nIn the HUD perf tray, adding 400 leaderboard rows no longer syncs the\nhud_race artboard\u0027s root layout 400 times, and makes 1 fewer allocation\nper row.\n\n* perf(runtime): tell whether a list shows a row\u0027s artboard without scanning\n\nEvery time a row\u0027s layout changed, the list checked that the row\u0027s\nartboard was showing by scanning all its realized rows, so adding N rows,\neach marking its layout dirty several times while it set up, cost O(N^2).\nPutting an artboard in a row now tells it the row, and the list checks\nthat one row first. Without repeated items an artboard sits in one row at\nmost, the last it was put in, so a row that no longer holds it means none\ndoes. A list that repeats items still scans when that row doesn\u0027t match.\n\nThe row sits in Artboard\u0027s padding, so Artboard stays 1080 bytes.\n\nWith the seven commits before it (CLI bench, M2 Max): in the HUD perf\ntray an added leaderboard row makes 39 fewer allocations (707.7 to\n668.7) and a lap time row 45 fewer, and Discord clone server and channel\nswitches allocate 2 to 6% less. Adding 400 leaderboard rows\nmeasures 5.7% faster, 100 rows 7.8% and 100 lap time rows 8.4%; removing\nrows and idle frames are unchanged within noise. Pixels match at all 69\nbench checkpoints of the HUD, Discord clone and calendar trays.\n\n* perf(runtime): tell a hosted artboard from a dirty layout without a virtual call\n\nMarking a layout dirty asks whether it\u0027s an artboard its host listed, and\nis\u003cArtboard\u003e() answered that with a virtual call on every mark. A state\nmachine that keys layout properties many times a frame stalled on it: since\nthe dirty layouts became a vector, one UAT corpus file (29581) ran 7% more\ncycles per frame on fewer instructions. An artboard is its own artboard(),\nso comparing that answers without the call.\n\nIn 29581, a steady frame takes 1.24 ms instead of 1.35 ms, and 18.9M\ninstead of 19.7M instructions (1.30 ms and 20.5M before this branch). The\ncorpus draws the same frames and makes the same allocations.\n\nRive-Mono-Commit: 4ca5e1e3e77075460ed1f466d6c09cc94cb9ea4f\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "52f67fea05fa9e6851e5200cdb00ffa84a9d2b23",
      "old_mode": 33188,
      "old_path": "include/rive/artboard.hpp",
      "new_id": "23854c3d36eda4fed061712288a4d6e737934938",
      "new_mode": 33188,
      "new_path": "include/rive/artboard.hpp"
    },
    {
      "type": "modify",
      "old_id": "76e8e436da55469b7f2a0113f0038c7b66587b85",
      "old_mode": 33188,
      "old_path": "include/rive/artboard_component_list.hpp",
      "new_id": "55945536d8cf533a9d50bfddbfa76167acaf058a",
      "new_mode": 33188,
      "new_path": "include/rive/artboard_component_list.hpp"
    },
    {
      "type": "modify",
      "old_id": "424147957fbc4bdc50cc58178acd5f46ccc3a038",
      "old_mode": 33188,
      "old_path": "include/rive/artboard_host.hpp",
      "new_id": "6827392c673d904d0dadfd6870eb0df3aa9dea96",
      "new_mode": 33188,
      "new_path": "include/rive/artboard_host.hpp"
    },
    {
      "type": "modify",
      "old_id": "4e5d95e9fd7ef4f8ee8b71bae4808b645f72a189",
      "old_mode": 33188,
      "old_path": "include/rive/component.hpp",
      "new_id": "49f866a95a63ad93a0636762b718bf94c7881c18",
      "new_mode": 33188,
      "new_path": "include/rive/component.hpp"
    },
    {
      "type": "modify",
      "old_id": "ff3f0781085d986fb033cc401b6b44c8af2e553c",
      "old_mode": 33188,
      "old_path": "include/rive/layout/layout_data.hpp",
      "new_id": "2a3a5dd10c9461ca427f2037d48bc6da8e6b5659",
      "new_mode": 33188,
      "new_path": "include/rive/layout/layout_data.hpp"
    },
    {
      "type": "modify",
      "old_id": "7651c0042d26130077d6c5b47463ab7d20183b42",
      "old_mode": 33188,
      "old_path": "include/rive/layout_component.hpp",
      "new_id": "c6a2fad8c42c8db7144ee999978b35bf1d428b83",
      "new_mode": 33188,
      "new_path": "include/rive/layout_component.hpp"
    },
    {
      "type": "modify",
      "old_id": "b91b9ab0e5f08221a194463119237a1109e20675",
      "old_mode": 33188,
      "old_path": "src/artboard.cpp",
      "new_id": "3b76e7178de86e276478fce5f2618e49866ba029",
      "new_mode": 33188,
      "new_path": "src/artboard.cpp"
    },
    {
      "type": "modify",
      "old_id": "8629ac9ba36e5c4a99777f1644766e5f572c43ab",
      "old_mode": 33188,
      "old_path": "src/artboard_component_list.cpp",
      "new_id": "08adba188e1edb748352080af30415784fd01f61",
      "new_mode": 33188,
      "new_path": "src/artboard_component_list.cpp"
    },
    {
      "type": "modify",
      "old_id": "abad78efbc3c0dec894cb5c862a362549318c3d1",
      "old_mode": 33188,
      "old_path": "src/component.cpp",
      "new_id": "79e939253f29f9f7dce385f8e0f231f610fb3295",
      "new_mode": 33188,
      "new_path": "src/component.cpp"
    },
    {
      "type": "modify",
      "old_id": "abe46da64bac2260890e6d67ccc59df71a198701",
      "old_mode": 33188,
      "old_path": "src/layout/grid_track.cpp",
      "new_id": "0aef87ac5dd61cb041aa39056f000076cc8ffd34",
      "new_mode": 33188,
      "new_path": "src/layout/grid_track.cpp"
    },
    {
      "type": "modify",
      "old_id": "852b104c6385b13d27817c8f3c848f7f2f4d6b74",
      "old_mode": 33188,
      "old_path": "src/layout_component.cpp",
      "new_id": "12c8db0a0cbda6cc6aa8ea942ebbf898a3977cec",
      "new_mode": 33188,
      "new_path": "src/layout_component.cpp"
    },
    {
      "type": "modify",
      "old_id": "77683846c3b51d4374f9d7cb105ad0f46d0349c6",
      "old_mode": 33188,
      "old_path": "src/shapes/path.cpp",
      "new_id": "44a8fadc364b23c4d4d6d8ef852dc93b54276a20",
      "new_mode": 33188,
      "new_path": "src/shapes/path.cpp"
    },
    {
      "type": "modify",
      "old_id": "c4ecd056911bbf010ef5c7f564579bc8bff534c2",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/component_list_test.cpp",
      "new_id": "991c220746335289297400155070d1c85e1f3f9d",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/component_list_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "358f611d7b1f623f9dcb4c85ae6d29377671e91b",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/instancing_test.cpp",
      "new_id": "81079c726dc7af9ba0af191615e4ce5ce0617a29",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/instancing_test.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "20d68069a5ad5f50359c00d755f34c57ce836dff",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/layout_style_applier_list_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "26d04f22383d6b2b51558dab015de53763e358a9",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/layout_test.cpp",
      "new_id": "91ecbcdea694149b004af2e0b8cbb29fba007248",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/layout_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "cfbafcf67ffd0b0c4cd7414ff2a4571d3527bfc1",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/rounded_rect_path_test.cpp",
      "new_id": "5305b40761f8d0b5ad8858a277e759f019b3e81a",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/rounded_rect_path_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "26158b25d9b447c1194d4f24a46c1bbbdb021a7d",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/state_machine_test.cpp",
      "new_id": "26bfdeba2a0478ce9873bcae1f6cd4b6ef499a66",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/state_machine_test.cpp"
    }
  ]
}
