[RFR] Adding hasChildren method to fix perf issues

To know if a node has children we do a count on the nodes list. On big tree is extremely slow. This PR replaces this by a call to NodeInterface::hasNodes().