PureXML/Sources
Mihaela Mihaljevic fb9dab2028 perf(serialize): scan a raw contiguous buffer for the escaping fast-paths
Fifth serialize-path pass (#139, docs/benchmarks.md pass 31). textNeedsEscaping,
attributeNeedsEscaping, and the comment/processingInstruction existence checks
run unconditionally on every text node, attribute value, comment, and PI in a
document, scanning through UTF8View's default Collection iteration. Profiling
a new deeply-nested, attribute-dense corpus (the standard flat catalog corpus
has no density to indict this) put the two needsEscaping functions as the
largest PureXML-specific frames in the sample. A standalone micro-benchmark
confirmed withContiguousStorageIfAvailable's raw buffer scan measures ~2-2.75x
faster than the Collection-based scan, with a Collection fallback kept for a
non-contiguous (foreign/bridged) string.

Two abstraction attempts were tried and rejected before landing this shape: a
shared generic helper taking a predicate closure recovered most but not all of
the win, and calling a separate small function from inside the buffer loop (to
dodge a cyclomatic-complexity violation) erased nearly the entire win even
though it isn't a closure value. The violation is instead resolved by splitting
each function into a contiguous/collection pair, moving the call boundary
outside the loop rather than inside it.

Output is byte-identical by construction; full local suite (1925 tests) and
full lint unchanged. Measured with interleaved same-state A/B under real
concurrent machine load: clean with zero overlap across 5 pairs at the nested
corpus (~9%), noisier at the standard corpus but the means still separate
clearly (~4%).
2026-07-15 04:25:59 +02:00
..
Canonical refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Catalog refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Emitting perf(serialize): scan a raw contiguous buffer for the escaping fast-paths 2026-07-15 04:25:59 +02:00
HTML refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Model refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Parsing refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Pattern refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Regex refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Schema refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
Stream chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
Validation refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
XInclude refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
XPath refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
XPointer refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
XSLT refactor(validation): decompose XSD instance validation into composable rules 2026-07-12 14:12:17 +02:00
API.swift perf(parse): build the TreeNode tree directly from the event stream (#295) 2026-06-25 14:15:57 +02:00
Lint.swift feat(editor): unified lint surface merging parse and validation diagnostics 2026-06-08 13:18:29 +02:00
PureXML.swift feat(html): lenient HTML parser and serializer 2026-06-08 07:12:42 +02:00
QuickFix.swift feat(editor): structured quick-fixes from completions 2026-06-08 13:35:33 +02:00