Cache the number of children of each node

This commit is contained in:
Anthony Ramine 2015-07-25 02:13:35 +02:00
parent a54404c921
commit a49eb14615
3 changed files with 46 additions and 17 deletions

View file

@ -123,8 +123,7 @@ pub trait ParallelPreorderDomTraversal : PreorderDomTraversal {
// Perform the appropriate traversal.
self.process(node);
// NB: O(n).
let child_count = node.children().count();
let child_count = node.children_count();
// Reset the count of children.
{