Quadratic behavior with namespaces in `xmlDocCopyNode`
xmlDocCopyNode
uses xmlSearchNs
to lookup namespaces. The latter iterates all namespace declarations of ancestor nodes, leading to quadratic behavior in trees with deep nesting and many namespace declarations. Copying of namespaces also seems more convoluted than necessary. I think we only need a hash table that stores whether a namespace was declared inside the copied subtree.