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 2015-04-12 22:45:42 +02:00
parent 235180e821
commit 739e3b474c
1 changed files with 3 additions and 1 deletions

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