Optimize Traversal#each_node allocations
This removes the need for allocating an Array for every set of child nodes.
This commit is contained in:
parent
235180e821
commit
739e3b474c
|
@ -39,7 +39,9 @@ module Oga
|
||||||
catch :skip_children do
|
catch :skip_children do
|
||||||
yield current
|
yield current
|
||||||
|
|
||||||
visit = current.children.to_a + visit
|
current.children.to_a.reverse_each do |child|
|
||||||
|
visit.unshift(child)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue