PureXML/Tests
Mihaela Mihaljevic f6a093fe4b
perf(xpath): compile the step node test once per query (#289)
The descendant and attribute walks tested every candidate node through a
closure that called matchesTree / matchesAttribute with the step's NodeTest and
the evaluation namespaces dictionary:

    descendants(of: tree) { matchesTree($0, step.test, on: step.axis, context.namespaces) }

That passes the namespaces dictionary (and the NodeTest's associated string) by
value on every call, so a //name-style query over a wide document carried a
dictionary retain/release on each of tens of thousands of nodes, on the
traversal that dominates evaluation.

compiledTreeTest, compiledAttributeTest, and compiledNodeTest resolve the parts
that do not change as the walk moves (the axis principal kind, whether eval-time
bindings are in effect, the prefix-wildcard shape of the name) exactly once and
return a tight per-node closure capturing only the local name. The selected
nodes are identical to the unfused matchesTree / matchesAttribute / matches.

Measured xpath ~35% faster on the 20k-item generated corpus via a same-state
A/B, from ~2.0x to ~1.3x slower than libxml2. The full suite, the Apache Xalan
XSLT gold-output corpus, and the WASM build stay green. XPathCompiledNodeTestTests
is an exhaustive differential asserting each compiled closure equals the
function it specializes across every node, test, axis, and binding.
2026-06-25 09:44:04 +02:00
..
Fixtures
AdversarialCriticTests.swift
ByteFastPathTests.swift perf(parsing): byte-level scanning fast paths halve parse time vs libxml2 (#275) 2026-06-24 18:46:58 +02:00
C14NSpecExampleTests.swift
CanonicalC14N11Tests.swift
CanonicalPrefixRewriteTests.swift
CanonicalSelectionTests.swift
CanonicalSubsetTests.swift
CanonicalTests.swift
CatalogBaseURITests.swift
CatalogGroupPreferTests.swift
CatalogSGMLTests.swift
CatalogSuffixPreferTests.swift
CatalogTests.swift
ConformanceCanonicalModesTests.swift
ConformanceCatalogTests.swift
ConformanceCorpusTests.swift
ConformanceDTDTests.swift
ConformanceEmittingTests.swift
ConformanceHTMLDepthTests.swift
ConformanceRegexTests.swift
ConformanceSchematronTests.swift
ConformanceXIncludeTests.swift
ConformanceXPathAxisTests.swift
ContentMatcherDifferentialTests.swift
ContentMatcherWorstCaseTests.swift
ContentModelDeterminismTests.swift
ContentNFAStateBudgetTests.swift
CoverageGateValueTypeTests.swift
DTDAttributeTests.swift
DTDConditionalNotationTests.swift
DTDDefaultingTests.swift
DTDEntityDeclaredTests.swift
DTDIdentifierTests.swift
DTDLocatedContentTests.swift
DTDParameterEntityDepthTests.swift
DTDStandaloneTests.swift
DTDSubsetStrictnessTests.swift
DTDTests.swift
DTDValidationTests.swift
DTDValidityConstraintTests.swift
EncodingMismatchTests.swift
EncodingTests.swift
EntityBaseURITests.swift
EntityResolverTests.swift
EntitySplicingTests.swift
ErrataValidityTests.swift
EscapingFastPathTests.swift perf(emitting): skip escaping rebuild for values that need no escaping (#279) 2026-06-25 00:56:52 +02:00
EXSLTTests.swift
HTMLAdoptionTests.swift
HTMLDocumentTests.swift
HTMLForeignContentTests.swift
HTMLFramesetTests.swift
HTMLSelectTests.swift
HTMLTests.swift
HTMLTokenizerTests.swift
HTMLValidationTests.swift
LineEndingTests.swift
LintTests.swift
ModelTests.swift
NamespaceConstraintTests.swift
NamespaceTests.swift
OutputEncodingTests.swift
ParityEdgeTests.swift
ParserPathDifferentialTests.swift perf(parsing): skip reference decoding for ampersand-free attribute values (#278) 2026-06-25 00:17:31 +02:00
ParsingTests.swift
PatternTests.swift
PullPushDifferentialTests.swift
PushParserTests.swift
QuickFixTests.swift
RecoveringReaderTests.swift
RegexCategoryTests.swift
RegexTests.swift
RelaxNGCombineTests.swift
RelaxNGCompactAnnotationTests.swift
RelaxNGCompactConcatTests.swift
RelaxNGCompactFollowAnnotationTests.swift
RelaxNGCompactParamTests.swift
RelaxNGCompactTests.swift
RelaxNGDataParamTests.swift
RelaxNGDatatypeLibraryTests.swift
RelaxNGIncludeTests.swift
RelaxNGLocatedErrorTests.swift
RelaxNGNameClassTests.swift
RelaxNGQNameTests.swift
RelaxNGSchemaCorrectnessTests.swift
RelaxNGSpecSuiteTests.swift
RelaxNGStreamingTests.swift
RelaxNGTests.swift
RelaxNGValueSpaceTests.swift
SaveOptionsTests.swift
SAXTests.swift
ScalarLexingTests.swift
SchemaAbstractXsiTypeTests.swift
SchemaAllGroupMinOccursTests.swift
SchemaAllGroupPlacementTests.swift
SchemaAllGroupReferenceTests.swift
SchemaAnySimpleTypeFacetTests.swift
SchemaAnyTypeLaxTests.swift
SchemaAttributeDefaultUseTests.swift
SchemaAttributeLocatedDiagnosticsTests.swift
SchemaAttributeRefTests.swift
SchemaAttributeRestrictionTests.swift
SchemaAttributeUniquenessTests.swift
SchemaAttributeWildcardIntersectionTests.swift
SchemaBlockDefaultTests.swift
SchemaCircularDerivationTests.swift
SchemaComposingTests.swift
SchemaCompositionLocatedDiagnosticsTests.swift
SchemaConformanceTests.swift
SchemaContainerTopLevelFormTests.swift
SchemaContentDerivationLocatedTests.swift
SchemaContentOrderTests.swift
SchemaDerivationControlTests.swift
SchemaDerivationLocatedDiagnosticsTests.swift
SchemaDeterminismGroupBlowupTests.swift
SchemaDifferentialHarness.swift
SchemaDifferentialTests.swift
SchemaDurationFacetTests.swift
SchemaElementBlockTests.swift
SchemaElementRefApplicabilityTests.swift
SchemaExtensionAllGroupTests.swift
SchemaExtensionSubstitutionLocatedTests.swift
SchemaFacetApplicabilityTests.swift
SchemaFacetDefinitionTests.swift
SchemaFixedElementChildrenTests.swift
SchemaForeignNamespaceReferenceTests.swift
SchemaFuzzTests.swift
SchemaGroupRedefineRestrictionTests.swift
SchemaIDAttributeTests.swift
SchemaIdentityDefaultValueTests.swift
SchemaIdentityFieldTypeTests.swift
SchemaIdentityValueEqualityTests.swift
SchemaIdentityXPathTests.swift
SchemaIDIDREFTests.swift
SchemaIDREFDefaultTests.swift
SchemaIDValueConstraintTests.swift
SchemaIncludeTests.swift
SchemaListFacetTests.swift
SchemaListUnionXsiTypeTests.swift
SchemaLocalElementBlockKeyTests.swift
SchemaLocatedDiagnosticsTests.swift
SchemaMixedEmptyTests.swift
SchemaMultiDocumentTests.swift
SchemaNamespacedDerivationTests.swift
SchemaNamesUPANotationLocatedTests.swift
SchemaNameUniquenessTests.swift
SchemaNestedDefinitionTests.swift
SchemaNilFixedTests.swift
SchemaNotationValidityTests.swift
SchemaParticleTypeRestrictionTests.swift
SchemaPatternFacetTests.swift
SchemaProhibitedAttributeTests.swift
SchemaQNameLengthTests.swift
SchemaRedefineAttributeGroupTests.swift
SchemaReferenceLocatedDiagnosticsTests.swift
SchemaReferenceTests.swift
SchemaRestrictionMixedTests.swift
SchemaSimpleContentChainTests.swift
SchemaSimpleContentFixedTests.swift
SchemaSimpleContentListTests.swift
SchemaSimpleContentRestrictionInlineTypeTests.swift
SchemaSimpleTypeFinalTests.swift
SchemaSimpleTypeLocatedDiagnosticsTests.swift
SchemaSimpleTypeRestrictionTests.swift
SchemaSimpleTypeVarietyTests.swift
SchemaStreamingValueConstraintTests.swift
SchemaStreamingXsiTypeGateTests.swift
SchemaStringWhitespaceTests.swift
SchemaStructureDerivationTests.swift
SchemaStructureLocatedDiagnosticsTests.swift
SchemaStructureTests.swift
SchemaSubstitutionBlockTests.swift
SchemaSubstitutionListUnionTests.swift
SchemaSubstitutionTypeBlockTests.swift
SchemaSubstitutionTypeTests.swift
SchemaTopLevelAttributeGroupTests.swift
SchemaTopLevelAttributeTests.swift
SchemaTopLevelElementTests.swift
SchemaTopLevelGroupTests.swift
SchematronAbstractPatternTests.swift
SchematronAbstractTests.swift
SchematronDiagnosticTests.swift
SchematronDynamicTests.swift
SchematronFunctionTests.swift
SchematronLetTests.swift
SchematronScopedLetTests.swift
SchematronTests.swift
SchemaTwoIDAttributesTests.swift
SchemaTypeExclusivityTests.swift
SchemaUnionFacetTests.swift
SchemaUserTypeValueConstraintTests.swift
SchemaValueConstraintExclusionTests.swift
SchemaValueConstraintTests.swift
SchemaValueConstraintValidityTests.swift
SchemaWhiteSpaceRestrictionTests.swift
SchemaWildcardNamespaceTests.swift
SchemaWildcardUnionExpressibilityTests.swift
SchemaXSIAttributeTests.swift
SchemaXSITypeUnionMemberBlockTests.swift fix(schema): block an xsi:type that reaches a union declared type through a member (#277) 2026-06-24 21:12:35 +02:00
SchemaXSTSDiagnosticTests.swift
SchemaXSTSRegressionTests.swift
SerializationEscapeTests.swift
SerializationOptionsTests.swift
SerializerTests.swift
SourceSpanTests.swift
StreamingDecoderJPTWTests.swift
StreamingDecoderTests.swift
StreamingDTDValidationTests.swift
StreamingXSDTests.swift
StrictRecoveringDifferentialTests.swift
StrictSubsetProfileTests.swift
TextReaderBreadthTests.swift
TextReaderTests.swift
TreeNodeEditingTests.swift
TreeNodeIdentityTests.swift
TreeNodeTests.swift
ValidationConfigurationTests.swift
ValidationFieldCoverageTests.swift
ValidationFrameworkTests.swift
ValidationRuleDTDTests.swift
ValidationRuleMiscTests.swift
ValidationRuleRegistryTests.swift
ValidationRuleStructuralTests.swift
ValidationRuleTestSupport.swift
ValidationRuleXSDTests.swift
ValidationTests.swift
ValidationWarningsTests.swift
W3CEduniSuiteTests.swift
W3CIBMSuiteTests.swift
W3CJapaneseSuiteTests.swift
W3COasisSuiteTests.swift
W3CSunSuiteTests.swift
W3CXMLSuiteTests.swift
WriterTests.swift
XalanConfSuiteTests.swift
XIncludeNegotiationTests.swift
XIncludeTests.swift
XMLCharacterTests.swift
XMLDeclarationTests.swift
XPathAxisTests.swift
XPathCompiledNodeTestTests.swift perf(xpath): compile the step node test once per query (#289) 2026-06-25 09:44:04 +02:00
XPathContextTests.swift
XPathDescendantFusionTests.swift perf(xpath): fuse // into a descendant step for non-positional predicates (#281) 2026-06-25 03:21:03 +02:00
XPathExpressionTests.swift
XPathFunctionTests.swift
XPathFusedAttributeTests.swift perf(xpath): fuse the node test into the attribute traversal (#287) 2026-06-25 07:51:29 +02:00
XPathFusedDescendantTests.swift perf(xpath): fuse the node test into the descendant traversal (#286) 2026-06-25 07:05:03 +02:00
XPathNamespaceTests.swift
XPathNodeSetDedupTests.swift perf(xpath): skip node-set de-duplication where no duplicate can arise (#280) 2026-06-25 01:33:50 +02:00
XPathSingleStepOrderTests.swift perf(xpath): skip the document-order sort for an already-ordered single step (#283) 2026-06-25 05:04:00 +02:00
XPathTests.swift
XPointerRangeTests.swift
XPointerTests.swift
XSDCategoryTests.swift
XSDCompletionTests2.swift
XSDComplexTypeTests.swift
XSDCompositionTests.swift
XSDDatatypeTests.swift
XSDDerivationControlTests.swift
XSDIdentityTests.swift
XSDImportTests.swift
XSDLocatedContentTests.swift
XSDNamespaceTests.swift
XSDParticleReferenceRestrictionTests.swift
XSDParticleRestrictionTests.swift
XSDRestrictionContentFreeOrderTests.swift
XSDSchemaTests.swift
XSDSchemaValidationTests.swift
XSDTypeResolutionTests.swift
XSDValueConstraintTests.swift
XSDWildcardTests.swift
XSLTApplyImportsTests.swift
XSLTAttributeSetTests.swift
XSLTCallTemplatePrecedenceTests.swift
XSLTCDATASectionTests.swift
XSLTCollationTests.swift
XSLTCompositionTests.swift
XSLTCreatedNamesTests.swift
XSLTDecimalFormatTests.swift
XSLTDoctypeOutputTests.swift
XSLTDocumentBaseURITests.swift
XSLTDocumentFunctionTests.swift
XSLTExpandedQNameTests.swift
XSLTFallbackTests.swift
XSLTFunctionTests.swift
XSLTGlobalVariableTests.swift
XSLTHTMLOutputTests.swift
XSLTKeyNodeSetTests.swift
XSLTMatchCacheTests.swift
XSLTMessageTests.swift
XSLTNamespaceAliasTests.swift
XSLTNumberingTests.swift
XSLTOutputMethodTests.swift
XSLTParityTests.swift
XSLTParserTests.swift
XSLTPatternPriorityTests.swift
XSLTResultFragmentTests.swift
XSLTSortCaseOrderTests.swift
XSLTTests.swift
XSLTWhitespaceTests.swift
XSTSDifferentialTests.swift
XSTSSuiteTests.swift fix(schema): block an xsi:type that reaches a union declared type through a member (#277) 2026-06-24 21:12:35 +02:00