PureXML/Sources/Model
Mihaela Mihaljevic d27e108b4d
perf(model): make the value Node tree type depth-safe (#344)
Element stored its children inline and Node was `indirect`, so a Node's
recursive layout made building, comparing, hashing, and releasing a deeply
nested tree recurse one native frame per level and overflow the stack
(signal 10) -- on a constrained stack such as a Swift Task, as shallow as a
few thousand deep.

Element now holds its children behind a copy-on-write reference
(ElementStorage), so Node is a fixed-size value (no longer indirect) and:

- `==` and `hashValue` walk the tree iteratively through explicit work
  stacks (the synthesized conformances recursed); equal trees still hash
  equally.
- ElementStorage's `deinit` flattens the subtree into a heap worklist
  before releasing, draining only storage it solely owns so a copy-on-write
  sibling keeps its subtree.
- `children` is a computed copy-on-write view with a `_modify` accessor, so
  in-place mutation (the parser's append loop) stays amortized O(1).

Value semantics are unchanged; Element/Node remain Equatable, Hashable,
Sendable. A 50000-deep tree builds, compares, hashes, and releases in a
fraction of a second; 1782 tests pass. Completes the value-Node half of #341.
2026-06-26 17:05:42 +02:00
..
Attribute.swift chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
Element.swift perf(model): make the value Node tree type depth-safe (#344) 2026-06-26 17:05:42 +02:00
ElementStorage.swift perf(model): make the value Node tree type depth-safe (#344) 2026-06-26 17:05:42 +02:00
Node.swift perf(model): make the value Node tree type depth-safe (#344) 2026-06-26 17:05:42 +02:00
QualifiedName.swift perf(parse): split the name prefix from a scanned colon offset (#292) 2026-06-25 12:23:53 +02:00
TreeNode.swift perf(model): make the TreeNode tree type depth-safe (#343) 2026-06-26 16:39:08 +02:00
TreeNodeConversion.swift perf(model): make the TreeNode tree type depth-safe (#343) 2026-06-26 16:39:08 +02:00
TreeNodeEditing.swift feat(model): TreeNode editing helpers (attributes, shallow copy, order, normalize) 2026-06-08 15:19:33 +02:00
TreeNodeIdentity.swift feat(model): first-class doctype/entity-reference/namespace nodes, ownerDocument, adoption (#90) 2026-06-09 03:43:24 +02:00
TreeNodeMutation.swift feat(model): mutable parent-aware tree (libxml2 tree.h parity) 2026-06-08 03:13:59 +02:00
TreeNodeNavigation.swift XSLT/XPath conformance: close 68 Apache Xalan cases (#254) 2026-06-24 00:13:14 +02:00
TreeNodeSpan.swift feat(schema): locate compile diagnostics with validation coding paths (#169) 2026-06-16 10:26:11 +02:00