`descendants(of:)` recursed on wrapped XPath nodes and, at every node, built a fresh array for that node's subtree and concatenated it (`result.append(contentsOf: descendants(of: child))`). That is an array allocation and copy per node, roughly O(n x depth) work over the subtree, and the parse profile showed it dominating XPath evaluation for a `//`-style query over a wide document. Recurse on the raw tree node instead, appending into one shared inout accumulator. The result is the identical node-set in the identical document order; only the way the array is built changes, from O(n x depth) to O(n). Measured xpath ~46% faster on the 20k-item generated corpus via a same-state A/B (count unchanged at 10000). Full suite, the Apache Xalan XSLT gold-output corpus, and the WASM build stay green. |
||
|---|---|---|
| .. | ||
| design | ||
| plans | ||
| rules | ||
| benchmarks.md | ||
| onboarding-antigravity.md | ||
| production-readiness.md | ||
| release-hurdles.md | ||
| roadmap.md | ||
| schema-validity-burndown.md | ||
| validation-coverage-registry.txt | ||
| validation-field-registry.txt | ||
| xsts-deviations.md | ||