Optimize Traversal#each_node allocations

This removes the need for allocating an Array for every set of child
nodes.
This commit is contained in:
Yorick Peterse committed 2015-04-12 22:45:42 +02:00
1 parent 235180e821
commit 739e3b474c
1 file changed
+3 -1
+3 -1
View File
@@ -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