PureXML/Sources/Validation
Mihaela Mihaljevic a77ffbd952
perf(model): make the TreeNode tree type depth-safe (#343)
Building a TreeNode from a value Node, projecting it back via `node`, and
releasing it each recursed one native frame per tree level, so a deeply
nested document overflowed the call stack (signal 10 around 30-60k deep,
and far shallower on a constrained stack such as a Swift Task). None of
these is fixed by the serializer, which was already iterative.

- `TreeNode(_:)` and `node`/`projectedChildren` now drive explicit
  post-order work stacks (entity-reference splicing, doctype/namespace
  dropping, and the root special-cases are unchanged).
- `deinit` flattens the subtree into a heap worklist before releasing, so
  each node frees with empty children and the teardown stays flat. Only a
  node the teardown solely owns (isKnownUniquelyReferenced) is flattened,
  so a child still referenced elsewhere keeps its subtree.
- The validator walk and the XPath descendant axis were made iterative for
  the same reason.

A 60000-deep tree now releases in well under 0.1s; 1778 tests pass and no
accepted output changes. Part of #341; the value Node's own recursive
release and XPath result ordering/dedup remain depth-bounded and tracked
there.
2026-06-26 16:39:08 +02:00
..
AttributeDeclaration.swift
AttributeDefault.swift
AttributeListParser.swift
AttributeType.swift
BuiltinValidation.swift
Conformance.swift
ContentModel.swift
ContentModelMatcher.swift
ContentModelParser.swift
DTDDeclarationValidity.swift
DTDDefaults.swift
DTDSchema.swift
DTDStandaloneValidity.swift
DTDValidationHelpers.swift
DTDValidations.swift
HasWarnings.swift
HTMLValidations.swift
Occurrence.swift
Particle.swift
Schematron.swift feat(schema): locate compile diagnostics with validation coding paths (#169) 2026-06-16 10:26:11 +02:00
SchematronModel.swift
SchematronParser.swift
Severity.swift
StreamingDTDValidator.swift
StructuralValidations.swift
Validation.swift
ValidationCombinators.swift
ValidationCore.swift
ValidationOutcome.swift
Validator.swift perf(model): make the TreeNode tree type depth-safe (#343) 2026-06-26 16:39:08 +02:00