From da154877da5d0b507a7d4890b6127f14ae39c54a Mon Sep 17 00:00:00 2001 From: ernisto Date: Sat, 15 Mar 2025 11:43:16 -0300 Subject: [PATCH] perf: little adjustments on `queue_children_for_update` --- src/graph.luau | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/graph.luau b/src/graph.luau index 6dfc9f2..d25b94b 100644 --- a/src/graph.luau +++ b/src/graph.luau @@ -207,13 +207,20 @@ local function queue_children_for_update(node: SourceNode) local i = update_queue.n local j = 1 - while node[j] do - if node[j].last_eval_update_id == update_id then j += 1; continue end + repeat + local child = node[j] + if not child then break end + + if child.last_eval_update_id == update_id then j += 1; continue end + if update_id > child.higher_parent_update_id then + child.higher_parent_update_id = update_id + end + i += 1 - node[j].higher_parent_update_id = math.max(update_id, node[j].higher_parent_update_id) - update_queue[i] = node[j] - unparent(node[j]) - end + update_queue[i] = child + unparent(child) + until false + update_queue.n = i end