perf: little adjustments on queue_children_for_update

This commit is contained in:
ernisto 2025-03-15 11:43:16 -03:00
parent 37c2dd9a5b
commit da154877da

View file

@ -207,13 +207,20 @@ local function queue_children_for_update<T>(node: SourceNode<T>)
local i = update_queue.n local i = update_queue.n
local j = 1 local j = 1
while node[j] do repeat
if node[j].last_eval_update_id == update_id then j += 1; continue end local child = node[j]
i += 1 if not child then break end
node[j].higher_parent_update_id = math.max(update_id, node[j].higher_parent_update_id)
update_queue[i] = node[j] if child.last_eval_update_id == update_id then j += 1; continue end
unparent(node[j]) if update_id > child.higher_parent_update_id then
child.higher_parent_update_id = update_id
end end
i += 1
update_queue[i] = child
unparent(child)
until false
update_queue.n = i update_queue.n = i
end end