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