Abstract
XML parsing is a computationally intensive task that often serves as a bottleneck in high-throughput web services. Traditional parsers perform redundant syntactic analysis on repetitive document structures common in enterprise environments. This paper introduces Deltarser, an adaptive XML parser that utilizes byte-sequence memorization to skip redundant processing. By storing previously encountered XML fragments and their associated SAX events in a Deterministic Finite Automaton (DFA), Deltarser achieves significant performance gains. Evaluation against industry standards shows speed improvements of up to 126% over Xerces and 70% over Piccolo.
Introduction
XML remains the foundational data format for web services, yet its verbosity imposes a significant "XML tax." Standard parsing involves a multi-stage pipeline: character encoding conversion, lexical analysis, syntax analysis, and namespace resolution. In many enterprise scenarios, such as SOAP-based middleware, the structural "boilerplate" of messages is highly repetitive, even when the payload data varies. Traditional parsers like Xerces treat every document as a novel input, wasting cycles re-analyzing identical structural patterns. Deltarser addresses this inefficiency by "learning" these patterns and matching raw byte sequences directly to pre-generated parse events.
Methodology: Byte-Level Memorization
Deltarser shifts the parsing workload from expensive syntactic analysis to efficient byte-level matching. The core architecture relies on a Deterministic Finite Automaton (DFA) where transitions are triggered by byte sequences.
Context-Aware Safety
To ensure semantic correctness, Deltarser tracks a formal Context during the matching process. This context includes element nesting levels, active namespace URI mappings, and document position. A byte sequence is only reused if the current context matches the context in which it was originally recorded. This prevents "unsafe" matches where identical byte strings might have different meanings in different parts of a document.
Incremental Learning and Event Reuse
When the byte sequence matcher encounters an unknown fragment, the system invokes a Partial Parser. This component performs standard parsing and "resynchronizes" with the DFA once a known state is reached. Crucially, the new fragment is then added to the DFA, allowing the system to handle that specific variation at byte-speed in future iterations. To further reduce overhead, Deltarser reuses immutable SAX event objects directly from the DFA, significantly lowering the cost of object allocation and garbage collection.
Experimental Evaluation
The authors evaluated Deltarser using real-world SOAP messages from Google Web APIs and multi-vendor scenarios (Apache Axis and Microsoft .NET). These tests measured the parser's ability to handle variations in whitespace and namespace prefixing.
Performance Results
Deltarser demonstrated superior performance across all benchmarks. In scenarios with high structural similarity, it was approximately 90% faster than Xerces and 70% faster than Piccolo. In mixed-vendor environments with higher variability, Deltarser maintained a lead of 106% over Xerces. The memory footprint remained manageable, with 800 unique document structures requiring approximately 64 MB of heap space.
Discussion and Limitations
The primary insight of this work is that byte-level matching is sufficient for XML parsing if the semantic context is correctly tracked. However, certain trade-offs exist:
- Cold Start: The initial creation of DFA paths is more expensive than standard parsing.
- Memory Management: Continuous learning in a long-running server could lead to memory exhaustion without a replacement policy like Least Recently Used (LRU).
- Encoding Constraints: The current implementation is optimized for stateless encodings like UTF-8.
Conclusion
Deltarser provides a high-performance alternative to traditional XML parsers by exploiting the structural redundancy of web service traffic. By combining byte-level memorization with strict context tracking, it offers a safe, adaptive, and significantly faster solution for modern enterprise applications.
Summary updated