source: docs/Balisage13/Bal2013came0601/Bal2013came0601.html @ 3050

Last change on this file since 3050 was 3050, checked in by lindanl, 6 years ago

minor changes

File size: 66.1 KB
Line 
1<html lang="en">
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title></title>
5<link rel="stylesheet" href="balisage-plain.css" type="text/css">
6<meta name="keywords" content="">
7</head>
8<body>
9<div id="balisage-header"><h1 style="text-align: right; font-family: serif; margin:0.25em">
10<i>Balisage:</i> <small>The Markup Conference</small>
11</h1></div>
12<div lang="en" class="article">
13<div class="titlepage">
14<h2 class="article-title" id="idp30464"></h2>
15<div class="author">
16<h3 class="author">Nigel Medforth</h3>
17<div class="affiliation">
18<p class="jobtitle">Developer</p>
19<p class="orgname">International Characters Inc.</p>
20</div>
21<div class="affiliation">
22<p class="jobtitle">Graduate Student, School of Computing Science</p>
23<p class="orgname">Simon Fraser University </p>
24</div>
25<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:nmedfort@sfu.ca">nmedfort@sfu.ca</a>&gt;</code></h5>
26</div>
27<div class="author">
28<h3 class="author">Dan Lin</h3>
29<div class="affiliation">
30<p class="jobtitle">Graduate Student, School of Computing Science</p>
31<p class="orgname">Simon Fraser University </p>
32</div>
33<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:lindanl@sfu.ca">lindanl@sfu.ca</a>&gt;</code></h5>
34</div>
35<div class="author">
36<h3 class="author">Kenneth Herdy</h3>
37<div class="affiliation">
38<p class="jobtitle">Graduate Student, School of Computing Science</p>
39<p class="orgname">Simon Fraser University </p>
40</div>
41<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:ksherdy@sfu.ca">ksherdy@sfu.ca</a>&gt;</code></h5>
42</div>
43<div class="author">
44<h3 class="author">Rob Cameron</h3>
45<div class="affiliation">
46<p class="jobtitle">Professor of Computing Science</p>
47<p class="orgname">Simon Fraser University</p>
48</div>
49<div class="affiliation">
50<p class="jobtitle">Chief Technology Officer</p>
51<p class="orgname">International Characters, Inc.</p>
52</div>
53<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:cameron@cs.sfu.ca">cameron@cs.sfu.ca</a>&gt;</code></h5>
54</div>
55<div class="author">
56<h3 class="author">Arrvindh Shriraman</h3>
57<div class="affiliation">
58<p class="jobtitle"></p>
59<p class="orgname"></p>
60</div>
61<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:"></a>&gt;</code></h5>
62</div>
63<div class="abstract">
64<p class="title"><b>Abstract</b></p>
65<p id="idp31888">Prior research on the acceleration of XML processing using SIMD and multi-core
66            parallelism has lead to a number of interesting research prototypes. This work
67            investigates the extent to which the techniques underlying these prototypes could result
68            in systematic performance benefits when fully integrated into a commercial XML parser.
69            The widely used Xerces-C++ parser of the Apache Software Foundation was chosen as the
70            foundation for the study. A systematic restructuring of the parser was undertaken, while
71            maintaining the existing API for application programmers. Using SIMD techniques alone,
72            an increase in parsing speed of at least 50% was observed in a range of applications.
73            When coupled with pipeline parallelism on dual core processors, improvements of 2x and
74            beyond were realized. </p>
75</div>
76<hr>
77</div>
78<div class="toc">
79<p><b>Table of Contents</b></p>
80<dl>
81<dt><span class="section"><a href="#idp240288" class="toc">Introduction</a></span></dt>
82<dt><span class="section"><a href="#idp242080" class="toc">Background</a></span></dt>
83<dd><dl>
84<dt><span class="section"><a href="#idp242720" class="toc">Xerces C++ Structure</a></span></dt>
85<dt><span class="section"><a href="#idp286496" class="toc">The Parabix Framework</a></span></dt>
86<dt><span class="section"><a href="#idm5136" class="toc">Sequential vs. Parallel Paradigm</a></span></dt>
87</dl></dd>
88<dt><span class="section"><a href="#idm1376" class="toc">Architecture</a></span></dt>
89<dd><dl>
90<dt><span class="section"><a href="#idp322064" class="toc">Overview</a></span></dt>
91<dt><span class="section"><a href="#idp349632" class="toc">Character Set Adapters</a></span></dt>
92<dt><span class="section"><a href="#idp358272" class="toc">Combined Parallel Filtering</a></span></dt>
93<dt><span class="section"><a href="#idp376928" class="toc">Content Stream</a></span></dt>
94<dt><span class="section"><a href="#idp387584" class="toc">Namespace Handling</a></span></dt>
95<dt><span class="section"><a href="#idp406880" class="toc">Error Handling</a></span></dt>
96</dl></dd>
97<dt><span class="section"><a href="#idp417920" class="toc">Multithreading with Pipeline Parallelism</a></span></dt>
98<dt><span class="section"><a href="#idp440784" class="toc">Performance</a></span></dt>
99<dd><dl>
100<dt><span class="section"><a href="#idp443504" class="toc">Xerces C++ SAXCount</a></span></dt>
101<dt><span class="section"><a href="#idp467808" class="toc">GML2SVG</a></span></dt>
102</dl></dd>
103<dt><span class="section"><a href="#idp486112" class="toc">Conclusion and Future Work</a></span></dt>
104</dl>
105</div>
106<div class="section" id="idp240288">
107<h2 class="title" style="clear: both">Introduction</h2>
108<p id="idp240928"></p>
109<p id="idp241184"></p>
110<p id="idp241440"></p>
111<p id="idp241696"></p>
112</div>
113<div class="section" id="idp242080">
114<h2 class="title" style="clear: both">Background</h2>
115<div class="section" id="idp242720">
116<h3 class="title" style="clear: both">Xerces C++ Structure</h3>
117<p id="idp243360"> The Xerces C++ parser
118           
119           
120             features comprehensive support for a variety of character encodings both
121            commonplace (e.g., UTF-8, UTF-16) and rarely used (e.g., EBCDIC), support for multiple
122            XML vocabularies through the XML namespace mechanism, as well as complete
123            implementations of structure and data validation through multiple grammars declared
124            using either legacy DTDs (document type definitions) or modern XML Schema facilities.
125            Xerces also supports several APIs for accessing parser services, including event-based
126            parsing using either pull parsing or SAX/SAX2 push-style parsing as well as a DOM
127            tree-based parsing interface. </p>
128<p id="idp245488">
129           
130           
131             Xerces,
132            like all traditional parsers, processes XML documents sequentially a byte-at-a-time from
133            the first to the last byte of input data. Each byte passes through several processing
134            layers and is classified and eventually validated within the context of the document
135            state. This introduces implicit dependencies between the various tasks within the
136            application that make it difficult to optimize for performance. As a complex software
137            system, no one feature dominates the overall parsing performance. Figure
138            \ref{fig:xerces-profile} shows the execution time profile of the top ten functions in a
139            typical run. Even if it were possible, Amdahl's Law dictates that tackling any one of
140            these functions for parallelization in isolation would only produce a minute improvement
141            in performance. Unfortunately, early investigation into these functions found that
142            incorporating speculation-free thread-level parallelization was impossible and they were
143            already performing well in their given tasks; thus only trivial enhancements were
144            attainable. In order to obtain a systematic acceleration of Xerces, it should be
145            expected that a comprehensive restructuring is required, involving all aspects of the
146            parser. </p>
147<div class="table-wrapper" id="idp248416">
148<p class="title">Table I</p>
149<div class="caption"><p id="idm37568">Execution Time of Top 10 Xerces Functions</p></div>
150<table class="table">
151<colgroup span="1">
152<col align="left" valign="top" span="1">
153<col align="left" valign="top" span="1">
154</colgroup>
155<thead><tr>
156<th>Time (%) </th>
157<th> Function Name </th>
158</tr></thead>
159<tbody>
160<tr valign="top">
161<td>13.29       </td>
162<td>XMLUTF8Transcoder::transcodeFrom </td>
163</tr>
164<tr valign="top">
165<td>7.45        </td>
166<td>IGXMLScanner::scanCharData </td>
167</tr>
168<tr valign="top">
169<td>6.83        </td>
170<td>memcpy </td>
171</tr>
172<tr valign="top">
173<td>5.83        </td>
174<td>XMLReader::getNCName </td>
175</tr>
176<tr valign="top">
177<td>4.67        </td>
178<td>IGXMLScanner::buildAttList </td>
179</tr>
180<tr valign="top">
181<td>4.54        </td>
182<td>RefHashTableO&lt;&gt;::findBucketElem </td>
183</tr>
184<tr valign="top">
185<td>4.20        </td>
186<td>IGXMLScanner::scanStartTagNS </td>
187</tr>
188<tr valign="top">
189<td>3.75        </td>
190<td>ElemStack::mapPrefixToURI </td>
191</tr>
192<tr valign="top">
193<td>3.58        </td>
194<td>ReaderMgr::getNextChar </td>
195</tr>
196<tr valign="top">
197<td>3.20        </td>
198<td>IGXMLScanner::basicAttrValueScan </td>
199</tr>
200</tbody>
201</table>
202</div>
203</div>
204<div class="section" id="idp286496">
205<h3 class="title" style="clear: both">The Parabix Framework</h3>
206<p id="idp287168"> The Parabix (parallel bit stream) framework is a transformative approach to XML
207            parsing (and other forms of text processing.) The key idea is to exploit the
208            availability of wide SIMD registers (e.g., 128-bit) in commodity processors to represent
209            data from long blocks of input data by using one register bit per single input byte. To
210            facilitate this, the input data is first transposed into a set of basis bit streams. In
211           
212            Boolean-logic operations\footnote{∧, \√ and ¬ denote the
213            boolean AND, OR and NOT operators.} are used to classify the input bits into a set of
214               <span class="ital">character-class bit streams</span>, which identify key
215            characters (or groups of characters) with a <code class="code">1</code>. For example, one of the
216            fundamental characters in XML is a left-angle bracket. A character is an
217               <code class="code">'&lt;' if and only if
218               Â¬(b<sub>0</sub> âˆš b<sub>1</sub>)
219               âˆ§ (b<sub>2</sub> âˆ§ b<sub>3</sub>)
220               âˆ§ (b<sub>4</sub> âˆ§ b<sub>5</sub>)
221               âˆ§ ¬ (b<sub>6</sub> âˆš
222               b<sub>7</sub>) = 1</code>. Similarly, a character is numeric, <code class="code">[0-9]
223               if and only if ¬(b<sub>0</sub> âˆš
224               b<sub>1</sub>) ∧ (b<sub>2</sub> âˆ§
225                  b<sub>3</sub>) ∧ ¬(b<sub>4</sub>
226               âˆ§ (b<sub>5</sub> âˆš
227            b<sub>6</sub>))</code>. An important observation here is that ranges of
228            characters may require fewer operations than individual characters and
229             multiple
230            classes can share the classification cost. </p>
231<p id="idp298736">
232           
233         </p>
234<p id="idp302672"> Consider, for example, the XML source data stream shown in the first line of
235            . The remaining lines of this figure show
236            several parallel bit streams that are computed in Parabix-style parsing, with each bit
237            of each stream in one-to-one correspondence to the source character code units of the
238            input stream. For clarity, 1 bits are denoted with 1 in each stream and 0 bits are
239            represented as underscores. The first bit stream shown is that for the opening angle
240            brackets that represent tag openers in XML. The second and third streams show a
241            partition of the tag openers into start tag marks and end tag marks depending on the
242            character immediately following the opener (i.e., <code class="code">"/"</code>) or
243            not. The remaining three lines show streams that can be computed in subsequent parsing
244            (using the technique of bitstream addition \cite{cameron-EuroPar2011}), namely streams
245            marking the element names, attribute names and attribute values of tags. </p>
246<p id="idm8496"> Two intuitions may help explain how the Parabix approach can lead to improved XML
247            parsing performance. The first is that the use of the full register width offers a
248            considerable information advantage over sequential byte-at-a-time parsing. That is,
249            sequential processing of bytes uses just 8 bits of each register, greatly limiting the
250            processor resources that are effectively being used at any one time. The second is that
251            byte-at-a-time loop scanning loops are actually often just computing a single bit of
252            information per iteration: is the scan complete yet? Rather than computing these
253            individual decision-bits, an approach that computes many of them in parallel (e.g., 128
254            bytes at a time using 128-bit registers) should provide substantial benefit. </p>
255<p id="idm7248"> Previous studies have shown that the Parabix approach improves many aspects of XML
256            processing, including transcoding \cite{Cameron2008}, character classification and
257            validation, tag parsing and well-formedness checking. The first Parabix parser used
258            processor bit scan instructions to considerably accelerate sequential scanning loops for
259            individual characters \cite{CameronHerdyLin2008}. Recent work has incorporated a method
260            of parallel scanning using bitstream addition \cite{cameron-EuroPar2011}, as well as
261            combining SIMD methods with 4-stage pipeline parallelism to further improve throughput
262            \cite{HPCA2012}. Although these research prototypes handled the full syntax of
263            schema-less XML documents, they lacked the functionality required by full XML parsers. </p>
264<p id="idm5984"> Commercial XML processors support transcoding of multiple character sets and can
265            parse and validate against multiple document vocabularies. Additionally, they provide
266            API facilities beyond those found in research prototypes, including the widely used SAX,
267            SAX2 and DOM interfaces. </p>
268</div>
269<div class="section" id="idm5136">
270<h3 class="title" style="clear: both">Sequential vs. Parallel Paradigm</h3>
271<p id="idm4496"> Xerces—like all traditional XML parsers—processes XML documents
272            sequentially. Each character is examined to distinguish between the XML-specific markup,
273            such as a left angle bracket <code class="code">&lt;</code>, and the content held within the
274            document. As the parser progresses through the document, it alternates between markup
275            scanning, validation and content processing modes. </p>
276<p id="idm2928"> In other words, Xerces belongs to an equivalent class applications termed FSM
277            applications\footnote{ Herein FSM applications are considered software systems whose
278            behaviour is defined by the inputs, current state and the events associated with
279            transitions of states.}. Each state transition indicates the processing context of
280            subsequent characters. Unfortunately, textual data tends to be unpredictable and any
281            character could induce a state transition. </p>
282<p id="idm2016"> Parabix-style XML parsers utilize a concept of layered processing. A block of source
283            text is transformed into a set of lexical bitstreams, which undergo a series of
284            operations that can be grouped into logical layers, e.g., transposition, character
285            classification, and lexical analysis. Each layer is pipeline parallel and require
286            neither speculation nor pre-parsing stages\cite{HPCA2012}. To meet the API requirements
287            of the document-ordered Xerces output, the results of the Parabix processing layers must
288            be interleaved to produce the equivalent behaviour. </p>
289</div>
290</div>
291<div class="section" id="idm1376">
292<h2 class="title" style="clear: both">Architecture</h2>
293<div class="section" id="idp322064">
294<h3 class="title" style="clear: both">Overview</h3>
295<p id="idp322960"> icXML is more than an optimized version of Xerces. Many components were grouped,
296            restructured and rearchitected with pipeline parallelism in mind. In this section, we
297            highlight the core differences between the two systems. As shown in Figure
298            \ref{fig:xerces-arch}, Xerces is comprised of five main modules: the transcoder, reader,
299            scanner, namespace binder, and validator. The <span class="ital">Transcoder</span> converts source data into UTF-16 before Xerces parses it as XML;
300            the majority of the character set encoding validation is performed as a byproduct of
301            this process. The <span class="ital">Reader</span> is responsible for the
302            streaming and buffering of all raw and transcoded (UTF-16) text. It tracks the current
303            line/column position,
304           
305            performs line-break normalization and validates context-specific character set issues,
306            such as tokenization of qualified-names. The <span class="ital">Scanner</span>
307            pulls data through the reader and constructs the intermediate representation (IR) of the
308            document; it deals with all issues related to entity expansion, validates the XML
309            well-formedness constraints and any character set encoding issues that cannot be
310            completely handled by the reader or transcoder (e.g., surrogate characters, validation
311            and normalization of character references, etc.) The <span class="ital">Namespace
312               Binder</span> is a core piece of the element stack. It handles namespace scoping
313            issues between different XML vocabularies. This allows the scanner to properly select
314            the correct schema grammar structures. The <span class="ital">Validator</span>
315            takes the IR produced by the Scanner (and potentially annotated by the Namespace Binder)
316            and assesses whether the final output matches the user-defined DTD and schema grammar(s)
317            before passing it to the end-user. </p>
318<div class="figure" id="xerces-arch">
319<p class="title">Figure 1: Xerces Architecture</p>
320<div class="figure-contents">
321<div class="mediaobject" id="idp329696"><img alt="png image (xerces.png)" src="xerces.png" width="150cm"></div>
322<div class="caption"></div>
323</div>
324</div>
325<p id="idp331952"> In icXML functions are grouped into logical components. As shown in Figure
326            \ref{fig:icxml-arch}, two major categories exist: (1) the Parabix Subsystem and (2) the
327            Markup Processor. All tasks in (1) use the Parabix Framework \cite{HPCA2012}, which
328            represents data as a set of parallel bitstreams. The <span class="ital">Character Set
329               Adapter</span>, discussed in Section \ref{arch:character-set-adapter}, mirrors
330            Xerces's Transcoder duties; however instead of producing UTF-16 it produces a set of
331            lexical bitstreams, similar to those shown in Figure \ref{fig:parabix1}. These lexical
332            bitstreams are later transformed into UTF-16 in the Content Stream Generator, after
333            additional processing is performed. The first precursor to producing UTF-16 is the
334               <span class="ital">Parallel Markup Parser</span> phase. It takes the lexical
335            streams and produces a set of marker bitstreams in which a 1-bit identifies significant
336            positions within the input data. One bitstream for each of the critical piece of
337            information is created, such as the beginning and ending of start tags, end tags,
338            element names, attribute names, attribute values and content. Intra-element
339            well-formedness validation is performed as an artifact of this process. Like Xerces,
340            icXML must provide the Line and Column position of each error. The <span class="ital">Line-Column Tracker</span> uses the lexical information to keep track of the
341            document position(s) through the use of an optimized population count algorithm,
342            described in Section \ref{section:arch:errorhandling}. From here, two data-independent
343            branches exist: the Symbol Resolver and Content Preparation Unit. </p>
344<p id="idp335968"> A typical XML file contains few unique element and attribute names—but
345            each of them will occur frequently. icXML stores these as distinct data structures,
346            called symbols, each with their own global identifier (GID). Using the symbol marker
347            streams produced by the Parallel Markup Parser, the <span class="ital">Symbol
348               Resolver</span> scans through the raw data to produce a sequence of GIDs, called
349            the <span class="ital">symbol stream</span>. </p>
350<p id="idp338448"> The final components of the Parabix Subsystem are the <span class="ital">Content
351               Preparation Unit</span> and <span class="ital">Content Stream
352            Generator</span>. The former takes the (transposed) basis bitstreams and selectively
353            filters them, according to the information provided by the Parallel Markup Parser, and
354            the latter transforms the filtered streams into the tagged UTF-16 <span class="ital">content stream</span>, discussed in Section \ref{section:arch:contentstream}. </p>
355<p id="idp341360"> Combined, the symbol and content stream form icXML's compressed IR of the XML
356            document. The <span class="ital">Markup Processor</span>~parses the IR to
357            validate and produce the sequential output for the end user. The <span class="ital">Final WF checker</span> performs inter-element well-formedness validation that
358            would be too costly to perform in bit space, such as ensuring every start tag has a
359            matching end tag. Xerces's namespace binding functionality is replaced by the <span class="ital">Namespace Processor</span>. Unlike Xerces, it is a discrete phase
360            that produces a series of URI identifiers (URI IDs), the <span class="ital">URI
361               stream</span>, which are associated with each symbol occurrence. This is
362            discussed in Section \ref{section:arch:namespacehandling}. Finally, the <span class="ital">Validation</span> layer implements the Xerces's validator. However,
363            preprocessing associated with each symbol greatly reduces the work of this stage. </p>
364<div class="figure" id="icxml-arch">
365<p class="title">Figure 2: icXML Architecture</p>
366<div class="figure-contents">
367<div class="mediaobject" id="idp347184"><img alt="png image (icxml.png)" src="icxml.png" width="500cm"></div>
368<div class="caption"></div>
369</div>
370</div>
371</div>
372<div class="section" id="idp349632">
373<h3 class="title" style="clear: both">Character Set Adapters</h3>
374<p id="idp350304"> In Xerces, all input is transcoded into UTF-16 to simplify the parsing costs of
375            Xerces itself and provide the end-consumer with a single encoding format. In the
376            important case of UTF-8 to UTF-16 transcoding, the transcoding costs can be significant,
377            because of the need to decode and classify each byte of input, mapping variable-length
378            UTF-8 byte sequences into 16-bit UTF-16 code units with bit manipulation operations. In
379            other cases, transcoding may involve table look-up operations for each byte of input. In
380            any case, transcoding imposes at least a cost of buffer copying. </p>
381<p id="idp352016"> In icXML, however, the concept of Character Set Adapters (CSAs) is used to minimize
382            transcoding costs. Given a specified input encoding, a CSA is responsible for checking
383            that input code units represent valid characters, mapping the characters of the encoding
384            into the appropriate bitstreams for XML parsing actions (i.e., producing the lexical
385            item streams), as well as supporting ultimate transcoding requirements. All of this work
386            is performed using the parallel bitstream representation of the source input. </p>
387<p id="idp352992"> An important observation is that many character sets are an extension to the legacy
388            7-bit ASCII character set. This includes the various ISO Latin character sets, UTF-8,
389            UTF-16 and many others. Furthermore, all significant characters for parsing XML are
390            confined to the ASCII repertoire. Thus, a single common set of lexical item calculations
391            serves to compute lexical item streams for all such ASCII-based character sets. </p>
392<p id="idp353872"> A second observation is that—regardless of which character set is
393            used—quite often all of the characters in a particular block of input will be
394            within the ASCII range. This is a very simple test to perform using the bitstream
395            representation, simply confirming that the bit 0 stream is zero for the entire block.
396            For blocks satisfying this test, all logic dealing with non-ASCII characters can simply
397            be skipped. Transcoding to UTF-16 becomes trivial as the high eight bitstreams of the
398            UTF-16 form are each set to zero in this case. </p>
399<p id="idp355792"> A third observation is that repeated transcoding of the names of XML elements,
400            attributes and so on can be avoided by using a look-up mechanism. That is, the first
401            occurrence of each symbol is stored in a look-up table mapping the input encoding to a
402            numeric symbol ID. Transcoding of the symbol is applied at this time. Subsequent look-up
403            operations can avoid transcoding by simply retrieving the stored representation. As
404            symbol look up is required to apply various XML validation rules, there is achieves the
405            effect of transcoding each occurrence without additional cost. </p>
406<p id="idp356848"> The cost of individual character transcoding is avoided whenever a block of input is
407            confined to the ASCII subset and for all but the first occurrence of any XML element or
408            attribute name. Furthermore, when transcoding is required, the parallel bitstream
409            representation supports efficient transcoding operations. In the important case of UTF-8
410            to UTF-16 transcoding, the corresponding UTF-16 bitstreams can be calculated in bit
411            parallel fashion based on UTF-8 streams \cite{Cameron2008}, and all but the final bytes
412            of multi-byte sequences can be marked for deletion as discussed in the following
413            subsection. In other cases, transcoding within a block only need be applied for
414            non-ASCII bytes, which are conveniently identified by iterating through the bit 0 stream
415            using bit scan operations. </p>
416</div>
417<div class="section" id="idp358272">
418<h3 class="title" style="clear: both">Combined Parallel Filtering</h3>
419<p id="idp358960"> As just mentioned, UTF-8 to UTF-16 transcoding involves marking all but the last
420            bytes of multi-byte UTF-8 sequences as positions for deletion. For example, the two
421            Chinese characters <code class="code">䜠奜</code> are represented as two
422            three-byte UTF-8 sequences <code class="code">E4 BD A0</code> and <code class="code">E5 A5 BD</code> while the
423            UTF-16 representation must be compressed down to the two code units <code class="code">4F60</code>
424            and <code class="code">597D</code>. In the bit parallel representation, this corresponds to a
425            reduction from six bit positions representing UTF-8 code units (bytes) down to just two
426            bit positions representing UTF-16 code units (double bytes). This compression may be
427            achieved by arranging to calculate the correct UTF-16 bits at the final position of each
428            sequence and creating a deletion mask to mark the first two bytes of each 3-byte
429            sequence for deletion. In this case, the portion of the mask corresponding to these
430            input bytes is the bit sequence <code class="code">110110</code>. Using this approach, transcoding
431            may then be completed by applying parallel deletion and inverse transposition of the
432            UTF-16 bitstreams\cite{Cameron2008}. </p>
433<p id="idp363120">
434           
435           
436           
437           
438           
439           
440           
441           
442           
443         </p>
444<p id="idp367056"> Rather than immediately paying the costs of deletion and transposition just for
445            transcoding, however, icXML defers these steps so that the deletion masks for several
446            stages of processing may be combined. In particular, this includes core XML requirements
447            to normalize line breaks and to replace character reference and entity references by
448            their corresponding text. In the case of line break normalization, all forms of line
449            breaks, including bare carriage returns (CR), line feeds (LF) and CR-LF combinations
450            must be normalized to a single LF character in each case. In icXML, this is achieved by
451            first marking CR positions, performing two bit parallel operations to transform the
452            marked CRs into LFs, and then marking for deletion any LF that is found immediately
453            after the marked CR as shown by the Pablo source code in Figure
454            \ref{fig:LBnormalization}.
455           
456         </p>
457<p id="idp369696"> In essence, the deletion masks for transcoding and for line break normalization each
458            represent a bitwise filter; these filters can be combined using bitwise-or so that the
459            parallel deletion algorithm need only be applied once. </p>
460<p id="idp370816"> A further application of combined filtering is the processing of XML character and
461            entity references. Consider, for example, the references <code class="code">&amp;</code> or
462               <code class="code">&lt;</code>. which must be replaced in XML processing with the single
463               <code class="code">&amp;</code> and <code class="code">&lt;</code> characters, respectively. The
464            approach in icXML is to mark all but the first character positions of each reference for
465            deletion, leaving a single character position unmodified. Thus, for the references
466               <code class="code">&amp;</code> or <code class="code">&lt;</code> the masks <code class="code">01111</code> and
467               <code class="code">011111</code> are formed and combined into the overall deletion mask. After the
468            deletion and inverse transposition operations are finally applied, a post-processing
469            step inserts the proper character at these positions. One note about this process is
470            that it is speculative; references are assumed to generally be replaced by a single
471            UTF-16 code unit. In the case, that this is not true, it is addressed in
472            post-processing. </p>
473<p id="idp375600"> The final step of combined filtering occurs during the process of reducing markup
474            data to tag bytes preceding each significant XML transition as described in
475            section~\ref{section:arch:contentstream}. Overall, icXML avoids separate buffer copying
476            operations for each of the these filtering steps, paying the cost of parallel deletion
477            and inverse transposition only once. Currently, icXML employs the parallel-prefix
478            compress algorithm of Steele~\cite{HackersDelight} Performance is independent of the
479            number of positions deleted. Future versions of icXML are expected to take advantage of
480            the parallel extract operation~\cite{HilewitzLee2006} that Intel is now providing in its
481            Haswell architecture. </p>
482</div>
483<div class="section" id="idp376928">
484<h3 class="title" style="clear: both">Content Stream</h3>
485<p id="idp377600"> A relatively-unique concept for icXML is the use of a filtered content stream.
486            Rather that parsing an XML document in its original format, the input is transformed
487            into one that is easier for the parser to iterate through and produce the sequential
488            output. In , the source data
489           
490            is transformed into
491           
492            through the parallel filtering algorithm, described in section \ref{sec:parfilter}. </p>
493<p id="idp380000"> Combined with the symbol stream, the parser traverses the content stream to
494            effectively reconstructs the input document in its output form. The initial <span class="ital">0</span> indicates an empty content string. The following
495               <code class="code">&gt;</code> indicates that a start tag without any attributes is the first
496            element in this text and the first unused symbol, <code class="code">document</code>, is the element
497            name. Succeeding that is the content string <code class="code">fee</code>, which is null-terminated
498            in accordance with the Xerces API specification. Unlike Xerces, no memory-copy
499            operations are required to produce these strings, which as
500            Figure~\ref{fig:xerces-profile} shows accounts for 6.83% of Xerces's execution time.
501            Additionally, it is cheap to locate the terminal character of each string: using the
502            String End bitstream, the Parabix Subsystem can effectively calculate the offset of each
503            null character in the content stream in parallel, which in turn means the parser can
504            directly jump to the end of every string without scanning for it. </p>
505<p id="idp383392"> Following <code class="code">'fee'</code> is a <code class="code">=</code>, which marks the
506            existence of an attribute. Because all of the intra-element was performed in the Parabix
507            Subsystem, this must be a legal attribute. Since attributes can only occur within start
508            tags and must be accompanied by a textual value, the next symbol in the symbol stream
509            must be the element name of a start tag, and the following one must be the name of the
510            attribute and the string that follows the <code class="code">=</code> must be its value. However, the
511            subsequent <code class="code">=</code> is not treated as an independent attribute because the parser
512            has yet to read a <code class="code">&gt;</code>, which marks the end of a start tag. Thus only
513            one symbol is taken from the symbol stream and it (along with the string value) is added
514            to the element. Eventually the parser reaches a <code class="code">/</code>, which marks the
515            existence of an end tag. Every end tag requires an element name, which means they
516            require a symbol. Inter-element validation whenever an empty tag is detected to ensure
517            that the appropriate scope-nesting rules have been applied. </p>
518</div>
519<div class="section" id="idp387584">
520<h3 class="title" style="clear: both">Namespace Handling</h3>
521<p id="idp388672"> In XML, namespaces prevents naming conflicts when multiple vocabularies are used
522            together. It is especially important when a vocabulary application-dependant meaning,
523            such as when XML or SVG documents are embedded within XHTML files. Namespaces are bound
524            to uniform resource identifiers (URIs), which are strings used to identify specific
525            names or resources. On line 1 of Figure \ref{fig:namespace1}, the <code class="code">xmlns</code>
526            attribute instructs the XML processor to bind the prefix <code class="code">p</code> to the URI
527               '<code class="code">pub.net</code>' and the default (empty) prefix to
528               <code class="code">book.org</code>. Thus to the XML processor, the <code class="code">title</code> on line 2
529            and <code class="code">price</code> on line 4 both read as
530            <code class="code">"book.org":title</code> and
531               <code class="code">"book.org":price</code> respectively, whereas on line 3 and
532            5, <code class="code">p:name</code> and <code class="code">price</code> are seen as
533               <code class="code">"pub.net":name</code> and
534               <code class="code">"pub.net":price</code>. Even though the actual element name
535               <code class="code">price</code>, due to namespace scoping rules they are viewed as two
536            uniquely-named items because the current vocabulary is determined by the namespace(s)
537            that are in-scope. </p>
538<p id="idp395792">
539           
540         </p>
541<p id="idp396336"> In both Xerces and icXML, every URI has a one-to-one mapping to a URI ID. These
542            persist for the lifetime of the application through the use of a global URI pool. Xerces
543            maintains a stack of namespace scopes that is pushed (popped) every time a start tag
544            (end tag) occurs in the document. Because a namespace declaration affects the entire
545            element, it must be processed prior to grammar validation. This is a costly process
546            considering that a typical namespaced XML document only comes in one of two forms: (1)
547            those that declare a set of namespaces upfront and never change them, and (2) those that
548            repeatedly modify the namespaces in predictable patterns. </p>
549<p id="idp398048"> For that reason, icXML contains an independent namespace stack and utilizes bit
550            vectors to cheaply perform
551             When a prefix is
552            declared (e.g., <code class="code">xmlns:p="pub.net"</code>), a namespace binding
553            is created that maps the prefix (which are assigned Prefix IDs in the symbol resolution
554            process) to the URI. Each unique namespace binding has a unique namespace id (NSID) and
555            every prefix contains a bit vector marking every NSID that has ever been associated with
556            it within the document. For example, in Table \ref{tbl:namespace1}, the prefix binding
557            set of <code class="code">p</code> and <code class="code">xmlns</code> would be <code class="code">01</code> and
558            <code class="code">11</code> respectively. To resolve the in-scope namespace binding for each prefix,
559            a bit vector of the currently visible namespaces is maintained by the system. By ANDing
560            the prefix bit vector with the currently visible namespaces, the in-scope NSID can be
561            found using a bit-scan intrinsic. A namespace binding table, similar to Table
562            \ref{tbl:namespace1}, provides the actual URI ID. </p>
563<p id="idp402432">
564           
565         </p>
566<p id="idp402976">
567           
568           
569           
570           
571         </p>
572<p id="idp405424"> To ensure that scoping rules are adhered to, whenever a start tag is encountered,
573            any modification to the currently visible namespaces is calculated and stored within a
574            stack of bit vectors denoting the locally modified namespace bindings. When an end tag
575            is found, the currently visible namespaces is XORed with the vector at the top of the
576            stack. This allows any number of changes to be performed at each scope-level with a
577            constant time.
578           
579         </p>
580</div>
581<div class="section" id="idp406880">
582<h3 class="title" style="clear: both">Error Handling</h3>
583<p id="idp407552">
584           
585            Xerces outputs error messages in two ways: through the programmer API and as thrown
586            objects for fatal errors. As Xerces parses a file, it uses context-dependant logic to
587            assess whether the next character is legal; if not, the current state determines the
588            type and severity of the error. icXML emits errors in the similar manner—but
589            how it discovers them is substantially different. Recall that in Figure
590            \ref{fig:icxml-arch}, icXML is divided into two sections: the Parabix Subsystem and
591            Markup Processor, each with its own system for detecting and producing error messages. </p>
592<p id="idp409184"> Within the Parabix Subsystem, all computations are performed in parallel, a block at
593            a time. Errors are derived as artifacts of bitstream calculations, with a 1-bit marking
594            the byte-position of an error within a block, and the type of error is determined by the
595            equation that discovered it. The difficulty of error processing in this section is that
596            in Xerces the line and column number must be given with every error production. Two
597            major issues exist because of this: (1) line position adheres to XML white-normalization
598            rules; as such, some sequences of characters, e.g., a carriage return followed by a line
599            feed, are counted as a single new line character. (2) column position is counted in
600            characters, not bytes or code units; thus multi-code-unit code-points and surrogate
601            character pairs are all counted as a single column position. Note that typical XML
602            documents are error-free but the calculation of the line/column position is a constant
603            overhead in Xerces.  To
604            reduce this, icXML pushes the bulk cost of the line/column calculation to the occurrence
605            of the error and performs the minimal amount of book-keeping necessary to facilitate it.
606            icXML leverages the byproducts of the Character Set Adapter (CSA) module and amalgamates
607            the information within the Line Column Tracker (LCT). One of the CSA's major
608            responsibilities is transcoding an input text.
609             During this process,
610            white-space normalization rules are applied and multi-code-unit and surrogate characters
611            are detected and validated. A <span class="ital">line-feed bitstream</span>,
612            which marks the positions of the normalized new lines characters, is a natural
613            derivative of this process. Using an optimized population count algorithm, the line
614            count can be summarized cheaply for each valid block of text.
615             Column position is more
616            difficult to calculate. It is possible to scan backwards through the bitstream of new
617            line characters to determine the distance (in code-units) between the position between
618            which an error was detected and the last line feed. However, this distance may exceed
619            than the actual character position for the reasons discussed in (2). To handle this, the
620            CSA generates a <span class="ital">skip mask</span> bitstream by ORing together
621            many relevant bitstreams, such as all trailing multi-code-unit and surrogate characters,
622            and any characters that were removed during the normalization process. When an error is
623            detected, the sum of those skipped positions is subtracted from the distance to
624            determine the actual column number. </p>
625<p id="idp414672"> The Markup Processor is a state-driven machine. As such, error detection within it
626            is very similar to Xerces. However, reporting the correct line/column is a much more
627            difficult problem. The Markup Processor parses the content stream, which is a series of
628            tagged UTF-16 strings. Each string is normalized in accordance with the XML
629            specification. All symbol data and unnecessary whitespace is eliminated from the stream;
630            thus its impossible to derive the current location using only the content stream. To
631            calculate the location, the Markup Processor borrows three additional pieces of
632            information from the Parabix Subsystem: the line-feed, skip mask, and a <span class="ital">deletion mask stream</span>, which is a bitstream denoting the
633            (code-unit) position of every datum that was suppressed from the source during the
634            production of the content stream. Armed with these, it is possible to calculate the
635            actual line/column using the same system as the Parabix Subsystem until the sum of the
636            negated deletion mask stream is equal to the current position. </p>
637</div>
638</div>
639<div class="section" id="idp417920">
640<h2 class="title" style="clear: both">Multithreading with Pipeline Parallelism</h2>
641<p id="idp418560"> As discussed in section \ref{background:xerces}, Xerces can be considered a FSM
642         application. These are "embarrassingly
643         sequential."\cite{Asanovic:EECS-2006-183} and notoriously difficult to
644         parallelize. However, icXML is designed to organize processing into logical layers. In
645         particular, layers within the Parabix Subsystem are designed to operate over significant
646         segments of input data before passing their outputs on for subsequent processing. This fits
647         well into the general model of pipeline parallelism, in which each thread is in charge of a
648         single module or group of modules. </p>
649<p id="idp420416"> The most straightforward division of work in icXML is to separate the Parabix Subsystem
650         and the Markup Processor into distinct logical layers into two separate stages. The
651         resultant application, <span class="ital">icXML-p</span>, is a course-grained
652         software-pipeline application. In this case, the Parabix Subsystem thread
653               <code class="code">T<sub>1</sub></code> reads 16k of XML input <code class="code">I</code> at a
654         time and produces the content, symbol and URI streams, then stores them in a pre-allocated
655         shared data structure <code class="code">S</code>. The Markup Processor thread
656            <code class="code">T<sub>2</sub></code> consumes <code class="code">S</code>, performs well-formedness
657         and grammar-based validation, and the provides parsed XML data to the application through
658         the Xerces API. The shared data structure is implemented using a ring buffer, where every
659         entry contains an independent set of data streams. In the examples of Figure
660         \ref{threads_timeline1} and \ref{threads_timeline2}, the ring buffer has four entries. A
661         lock-free mechanism is applied to ensure that each entry can only be read or written by one
662         thread at the same time. In Figure \ref{threads_timeline1} the processing time of
663               <code class="code">T<sub>1</sub></code> is longer than
664         <code class="code">T<sub>2</sub></code>; thus <code class="code">T<sub>2</sub></code> always
665         waits for <code class="code">T<sub>1</sub></code> to write to the shared memory. Figure
666         \ref{threads_timeline2} illustrates the scenario in which
667         <code class="code">T<sub>1</sub></code> is faster and must wait for
668            <code class="code">T<sub>2</sub></code> to finish reading the shared data before it can
669         reuse the memory space. </p>
670<p id="idp429488">
671        <div class="figure" id="threads_timeline1">
672<p class="title">Figure 3: Thread Balance in Two-Stage Pipelines</p>
673<div class="figure-contents">
674<div class="mediaobject" id="idp430832"><img alt="png image (threads_timeline1.png)" src="threads_timeline1.png" width="500cm"></div>
675<div class="caption"></div>
676</div>
677</div>
678        <div class="figure" id="threads_timeline2">
679<p class="title">Figure 4: Thread Balance in Two-Stage Pipelines</p>
680<div class="figure-contents">
681<div class="mediaobject" id="idp434208"><img alt="png image (threads_timeline2.png)" src="threads_timeline2.png" width="500cm"></div>
682<div class="caption"></div>
683</div>
684</div>
685      </p>
686<p id="idp436624"> Overall, our design is intended to benefit a range of applications. Conceptually, we
687         consider two design points. The first, the parsing performed by the Parabix Subsystem
688         dominates at 67% of the overall cost, with the cost of application processing (including
689         the driver logic within the Markup Processor) at 33%. The second is almost the opposite
690         scenario, the cost of application processing dominates at 60%, while the cost of XML
691         parsing represents an overhead of 40%. </p>
692<p id="idp437536"> Our design is predicated on a goal of using the Parabix framework to achieve a 50% to
693         100% improvement in the parsing engine itself. In a best case scenario, a 100% improvement
694         of the Parabix Subsystem for the design point in which XML parsing dominates at 67% of the
695         total application cost. In this case, the single-threaded icXML should achieve a 1.5x
696         speedup over Xerces so that the total application cost reduces to 67% of the original.
697         However, in icXML-p, our ideal scenario gives us two well-balanced threads each performing
698         about 33% of the original work. In this case, Amdahl's law predicts that we could expect up
699         to a 3x speedup at best. </p>
700<p id="idp438656"> At the other extreme of our design range, we consider an application in which core
701         parsing cost is 40%. Assuming the 2x speedup of the Parabix Subsystem over the
702         corresponding Xerces core, single-threaded icXML delivers a 25% speedup. However, the most
703         significant aspect of our two-stage multi-threaded design then becomes the ability to hide
704         the entire latency of parsing within the serial time required by the application. In this
705         case, we achieve an overall speedup in processing time by 1.67x. </p>
706<p id="idp439600"> Although the structure of the Parabix Subsystem allows division of the work into
707         several pipeline stages and has been demonstrated to be effective for four pipeline stages
708         in a research prototype \cite{HPCA2012}, our analysis here suggests that the further
709         pipelining of work within the Parabix Subsystem is not worthwhile if the cost of
710         application logic is little as 33% of the end-to-end cost using Xerces. To achieve benefits
711         of further parallelization with multi-core technology, there would need to be reductions in
712         the cost of application logic that could match reductions in core parsing cost. </p>
713</div>
714<div class="section" id="idp440784">
715<h2 class="title" style="clear: both">Performance</h2>
716<p id="idp441456"> We evaluate Xerces-C++ 3.1.1, icXML, icXML-p against two benchmarking applications: the
717         Xerces C++ SAXCount sample application, and a real world GML to SVG transformation
718         application. We investigated XML parser performance using an Intel Core i7 quad-core (Sandy
719         Bridge) processor (3.40GHz, 4 physical cores, 8 threads (2 per core), 32+32 kB (per core)
720         L1 cache, 256 kB (per core) L2 cache, 8 MB L3 cache) running the 64-bit version of Ubuntu
721         12.04 (Linux). </p>
722<p id="idp442368"> We analyzed the execution profiles of each XML parser using the performance counters
723         found in the processor. We chose several key hardware events that provide insight into the
724         profile of each application and indicate if the processor is doing useful work. The set of
725         events included in our study are: processor cycles, branch instructions, branch
726         mispredictions, and cache misses. The Performance Application Programming Interface (PAPI)
727         Version 5.5.0 \cite{papi} toolkit was installed on the test system to facilitate the
728         collection of hardware performance monitoring statistics. In addition, we used the Linux
729         perf \cite{perf} utility to collect per core hardware events. </p>
730<div class="section" id="idp443504">
731<h3 class="title" style="clear: both">Xerces C++ SAXCount</h3>
732<p id="idp444176"> Xerces comes with sample applications that demonstrate salient features of the
733            parser. SAXCount is the simplest such application: it counts the elements, attributes
734            and characters of a given XML file using the (event based) SAX API and prints out the
735            totals. </p>
736<p id="idp444880"> Table \ref{XMLDocChars} shows the document characteristics of the XML input files
737            selected for the Xerces C++ SAXCount benchmark. The jaw.xml represents document-oriented
738            XML inputs and contains the three-byte and four-byte UTF-8 sequence required for the
739            UTF-8 encoding of Japanese characters. The remaining data files are data-oriented XML
740            documents and consist entirely of single byte encoded ASCII characters.
741  <div class="table-wrapper" id="idp445616">
742<p class="title">Table II</p>
743<div class="caption"><p id="idp446128">XML Document Characteristics</p></div>
744<table class="table">
745<colgroup span="1">
746<col align="left" valign="top" span="1">
747<col align="left" valign="top" span="1">
748<col align="left" valign="top" span="1">
749<col align="left" valign="top" span="1">
750<col align="left" valign="top" span="1">
751</colgroup>
752<tbody>
753<tr>
754<td>File Name           </td>
755<td> jaw.xml            </td>
756<td> road.gml   </td>
757<td> po.xml     </td>
758<td> soap.xml </td>
759</tr>
760<tr>
761<td>File Type           </td>
762<td> document           </td>
763<td> data               </td>
764<td> data               </td>
765<td> data        </td>
766</tr>
767<tr>
768<td>File Size (kB)              </td>
769<td> 7343                       </td>
770<td> 11584      </td>
771<td> 76450              </td>
772<td> 2717 </td>
773</tr>
774<tr>
775<td>Markup Item Count   </td>
776<td> 74882              </td>
777<td> 280724     </td>
778<td> 4634110    </td>
779<td> 18004 </td>
780</tr>
781<tr>
782<td>Markup Density              </td>
783<td> 0.13                       </td>
784<td> 0.57       </td>
785<td> 0.76               </td>
786<td> 0.87       </td>
787</tr>
788</tbody>
789</table>
790</div>           
791</p>
792<p id="idp461808"> A key predictor of the overall parsing performance of an XML file is markup
793            density\footnote{ Markup Density: the ratio of markup bytes used to define the structure
794            of the document vs. its file size.}. This metric has substantial influence on the
795            performance of traditional recursive descent XML parsers because it directly corresponds
796            to the number of state transitions that occur when parsing a document. We use a mixture
797            of document-oriented and data-oriented XML files to analyze performance over a spectrum
798            of markup densities. </p>
799<p id="idp462816"> Figure \ref{perf_SAX} compares the performance of Xerces, icXML and pipelined icXML
800            in terms of CPU cycles per byte for the SAXCount application. The speedup for icXML over
801            Xerces is 1.3x to 1.8x. With two threads on the multicore machine, icXML-p can achieve
802            speedup up to 2.7x. Xerces is substantially slowed by dense markup but icXML is less
803            affected through a reduction in branches and the use of parallel-processing techniques.
804            icXML-p performs better as markup-density increases because the work performed by each
805            stage is well balanced in this application. </p>
806<p id="idp463856">
807        <div class="figure" id="perf_SAX">
808<p class="title">Figure 5: SAXCount Performance Comparison</p>
809<div class="figure-contents">
810<div class="mediaobject" id="idp465264"><img alt="png image (perf_SAX.png)" src="perf_SAX.png" width="500cm"></div>
811<div class="caption"></div>
812</div>
813</div>
814         </p>
815</div>
816<div class="section" id="idp467808">
817<h3 class="title" style="clear: both">GML2SVG</h3>
818<p id="idp468480">       As a more substantial application of XML processing, the GML-to-SVG (GML2SVG) application
819was chosen.   This application transforms geospatially encoded data represented using
820an XML representation in the form of Geography Markup Language (GML) \cite{lake2004geography}
821into a different XML format  suitable for displayable maps:
822Scalable Vector Graphics (SVG) format\cite{lu2007advances}. In the GML2SVG benchmark, GML feature elements
823and GML geometry elements tags are matched. GML coordinate data are then extracted
824and transformed to the corresponding SVG path data encodings.
825Equivalent SVG path elements are generated and output to the destination
826SVG document.  The GML2SVG application is thus considered typical of a broad
827class of XML applications that parse and extract information from
828a known XML format for the purpose of analysis and restructuring to meet
829the requirements of an alternative format.</p>
830<p id="idp470720">Our GML to SVG data translations are executed on GML source data
831modelling the city of Vancouver, British Columbia, Canada.
832The GML source document set
833consists of 46 distinct GML feature layers ranging in size from approximately 9 KB to 125.2 MB
834and with an average document size of 18.6 MB. Markup density ranges from approximately 0.045 to 0.719
835and with an average markup density of 0.519. In this performance study,
836213.4 MB of source GML data generates 91.9 MB of target SVG data.</p>
837<div class="figure" id="perf_GML2SVG">
838<p class="title">Figure 6: Performance Comparison for GML2SVG</p>
839<div class="figure-contents">
840<div class="mediaobject" id="idp472704"><img alt="png image (Throughput.png)" src="Throughput.png" width="500cm"></div>
841<div class="caption"></div>
842</div>
843</div>
844<p id="idp474992">Figure \ref{perf_GML2SVG} compares the performance of the GML2SVG application linked against
845the Xerces, \icXML{} and \icXMLp{}.   
846On the GML workload with this application, single-thread \icXML{}
847achieved about a 50\% acceleration over Xerces,
848increasing throughput on our test machine from 58.3 MB/sec to 87.9 MB/sec.   
849Using \icXMLp{}, a further throughput increase to 111 MB/sec was recorded,
850approximately a 2X speedup.</p>
851<p id="idp475824">An important aspect of \icXML{} is the replacement of much branch-laden
852sequential code inside Xerces with straight-line SIMD code using far
853fewer branches.  Figure \ref{branchmiss_GML2SVG} shows the corresponding
854improvement in branching behaviour, with a dramatic reduction in branch misses per kB.
855It is also interesting to note that \icXMLp{} goes even further.   
856In essence, in using pipeline parallelism to split the instruction
857stream onto separate cores, the branch target buffers on each core are
858less overloaded and able to increase the successful branch prediction rate.</p>
859<div class="figure" id="branchmiss_GML2SVG">
860<p class="title">Figure 7: Comparative Branch Misprediction Rate</p>
861<div class="figure-contents">
862<div class="mediaobject" id="idp477936"><img alt="png image (BM.png)" src="BM.png" width="500cm"></div>
863<div class="caption"></div>
864</div>
865</div>
866<p id="idp480224">The behaviour of the three versions with respect to L1 cache misses per kB is shown
867in Figure \ref{cachemiss_GML2SVG}.   Improvements are shown in both instruction-
868and data-cache performance with the improvements in instruction-cache
869behaviour the most dramatic.   Single-threaded \icXML{} shows substantially improved
870performance over Xerces on both measures.   
871Although \icXMLp{} is slightly worse \wrt{} data-cache performance,
872this is more than offset by a further dramatic reduction in instruction-cache miss rate.
873Again partitioning the instruction stream through the pipeline parallelism model has
874significant benefit.</p>
875<div class="figure" id="cachemiss_GML2SVG">
876<p class="title">Figure 8: Comparative Cache Miss Rate</p>
877<div class="figure-contents">
878<div class="mediaobject" id="idp482336"><img alt="png image (CM.png)" src="CM.png" width="500cm"></div>
879<div class="caption"></div>
880</div>
881</div>
882<p id="idp484624">One caveat with this study is that the GML2SVG application did not exhibit
883a relative balance of processing between application code and Xerces library
884code reaching the 33\% figure.  This suggests that for this application and
885possibly others, further separating the logical layers of the
886\icXML{} engine into different pipeline stages could well offer significant benefit.
887This remains an area of ongoing work.</p>
888</div>
889</div>
890<div class="section" id="idp486112">
891<h2 class="title" style="clear: both">Conclusion and Future Work</h2>
892<p id="idp486800"> This paper is the first case study documenting the significant performance benefits
893         that may be realized through the integration of parallel bitstream technology into existing
894         widely-used software libraries. In the case of the Xerces-C++ XML parser, the combined
895         integration of SIMD and multicore parallelism was shown capable of dramatic producing
896         dramatic increases in throughput and reductions in branch mispredictions and cache misses.
897         The modified parser, going under the name icXML is designed to provide the full
898         functionality of the original Xerces library with complete compatibility of APIs. Although
899         substantial re-engineering was required to realize the performance potential of parallel
900         technologies, this is an important case study demonstrating the general feasibility of
901         these techniques. </p>
902<p id="idp488080"> The further development of icXML to move beyond 2-stage pipeline parallelism is
903         ongoing, with realistic prospects for four reasonably balanced stages within the library.
904         For applications such as GML2SVG which are dominated by time spent on XML parsing, such a
905         multistage pipelined parsing library should offer substantial benefits. </p>
906<p id="idp488848"> The example of XML parsing may be considered prototypical of finite-state machines
907         applications which have sometimes been considered "embarassingly
908         sequential" and so difficult to parallelize that "nothing
909         works." So the case study presented here should be considered an important data
910         point in making the case that parallelization can indeed be helpful across a broad array of
911         application types. </p>
912<p id="idp490224"> To overcome the software engineering challenges in applying parallel bitstream
913         technology to existing software systems, it is clear that better library and tool support
914         is needed. The techniques used in the implementation of icXML and documented in this paper
915         could well be generalized for applications in other contexts and automated through the
916         creation of compiler technology specifically supporting parallel bitstream programming.
917      </p>
918</div>
919<div class="bibliography" id="idp491712">
920<h2 class="title" style="clear:both">Bibliography</h2>
921<p class="bibliomixed" id="XMLChip09">[Leventhal and Lemoine 2009] Leventhal, Michael and
922         Eric Lemoine 2009. The XML chip at 6 years. Proceedings of International Symposium on
923         Processing XML Efficiently 2009, Montréal.</p>
924<p class="bibliomixed" id="Datapower09">[Salz, Achilles and Maze 2009] Salz, Richard,
925         Heather Achilles, and David Maze. 2009. Hardware and software trade-offs in the IBM
926         DataPower XML XG4 processor card. Proceedings of International Symposium on Processing XML
927         Efficiently 2009, Montréal.</p>
928<p class="bibliomixed" id="PPoPP08">[Cameron 2007] Cameron, Robert D. 2007. A Case Study
929         in SIMD Text Processing with Parallel Bit Streams UTF-8 to UTF-16 Transcoding. Proceedings
930         of 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2008, Salt
931         Lake City, Utah. On the Web at <a href="http://research.ihost.com/ppopp08/" class="link" target="_new">http://research.ihost.com/ppopp08/</a>.</p>
932<p class="bibliomixed" id="CASCON08">[Cameron, Herdy and Lin 2008] Cameron, Robert D.,
933         Kenneth S Herdy, and Dan Lin. 2008. High Performance XML Parsing Using Parallel Bit Stream
934         Technology. Proceedings of CASCON 2008. 13th ACM SIGPLAN Symposium on Principles and
935         Practice of Parallel Programming 2008, Toronto.</p>
936<p class="bibliomixed" id="SVGOpen08">[Herdy, Burggraf and Cameron 2008] Herdy, Kenneth
937         S., Robert D. Cameron and David S. Burggraf. 2008. High Performance GML to SVG
938         Transformation for the Visual Presentation of Geographic Data in Web-Based Mapping Systems.
939         Proceedings of SVG Open 6th International Conference on Scalable Vector Graphics,
940         Nuremburg. On the Web at
941            <a href="http://www.svgopen.org/2008/papers/74-HighPerformance_GML_to_SVG_Transformation_for_the_Visual_Presentation_of_Geographic_Data_in_WebBased_Mapping_Systems/" class="link" target="_new">http://www.svgopen.org/2008/papers/74-HighPerformance_GML_to_SVG_Transformation_for_the_Visual_Presentation_of_Geographic_Data_in_WebBased_Mapping_Systems/</a>.</p>
942<p class="bibliomixed" id="Ross06">[Ross 2006] Ross, Kenneth A. 2006. Efficient hash
943         probes on modern processors. Proceedings of ICDE, 2006. ICDE 2006, Atlanta. On the Web at
944            <a href="www.cs.columbia.edu/~kar/pubsk/icde2007.pdf" class="link" target="_new">www.cs.columbia.edu/~kar/pubsk/icde2007.pdf</a>.</p>
945<p class="bibliomixed" id="ASPLOS09">[Cameron and Lin 2009] Cameron, Robert D. and Dan
946         Lin. 2009. Architectural Support for SWAR Text Processing with Parallel Bit Streams: The
947         Inductive Doubling Principle. Proceedings of ASPLOS 2009, Washington, DC.</p>
948<p class="bibliomixed" id="Wu08">[Wu et al. 2008] Wu, Yu, Qi Zhang, Zhiqiang Yu and
949         Jianhui Li. 2008. A Hybrid Parallel Processing for XML Parsing and Schema Validation.
950         Proceedings of Balisage 2008, Montréal. On the Web at
951            <a href="http://www.balisage.net/Proceedings/vol1/html/Wu01/BalisageVol1-Wu01.html" class="link" target="_new">http://www.balisage.net/Proceedings/vol1/html/Wu01/BalisageVol1-Wu01.html</a>.</p>
952<p class="bibliomixed" id="u8u16">[Cameron 2008] u8u16 - A High-Speed UTF-8 to UTF-16
953         Transcoder Using Parallel Bit Streams Technical Report 2007-18. 2007. School of Computing
954         Science Simon Fraser University, June 21 2007.</p>
955<p class="bibliomixed" id="XML10">[XML 1.0] Extensible Markup Language (XML) 1.0 (Fifth
956         Edition) W3C Recommendation 26 November 2008. On the Web at
957            <a href="http://www.w3.org/TR/REC-xml/" class="link" target="_new">http://www.w3.org/TR/REC-xml/</a>.</p>
958<p class="bibliomixed" id="Unicode">[Unicode] The Unicode Consortium. 2009. On the Web at
959            <a href="http://unicode.org/" class="link" target="_new">http://unicode.org/</a>.</p>
960<p class="bibliomixed" id="Pex06">[Hilewitz and Lee 2006]  Hilewitz, Y. and Ruby B. Lee.
961         2006. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit
962         Instructions. Proceedings of the IEEE 17th International Conference on Application-Specific
963         Systems, Architectures and Processors (ASAP), pp. 65-72, September 11-13, 2006.</p>
964<p class="bibliomixed" id="InfoSet">[XML Infoset] XML Information Set (Second Edition) W3C
965         Recommendation 4 February 2004. On the Web at
966         <a href="http://www.w3.org/TR/xml-infoset/" class="link" target="_new">http://www.w3.org/TR/xml-infoset/</a>.</p>
967<p class="bibliomixed" id="Saxon">[Saxon] SAXON The XSLT and XQuery Processor. On the Web
968         at <a href="http://saxon.sourceforge.net/" class="link" target="_new">http://saxon.sourceforge.net/</a>.</p>
969<p class="bibliomixed" id="Kay08">[Kay 2008]  Kay, Michael Y. 2008. Ten Reasons Why Saxon
970         XQuery is Fast, IEEE Data Engineering Bulletin, December 2008.</p>
971<p class="bibliomixed" id="AElfred">[Ælfred]  The Ælfred XML Parser. On the Web at
972            <a href="http://saxon.sourceforge.net/aelfred.html" class="link" target="_new">http://saxon.sourceforge.net/aelfred.html</a>.</p>
973<p class="bibliomixed" id="JNI">[Hitchens 2002] Hitchens, Ron. Java NIO. O'Reilly, 2002.</p>
974<p class="bibliomixed" id="Expat">[Expat] The Expat XML Parser.
975            <a href="http://expat.sourceforge.net/" class="link" target="_new">http://expat.sourceforge.net/</a>.</p>
976</div>
977</div>
978<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em">
979<i>Balisage:</i> <small>The Markup Conference</small>
980</h3></div>
981</body>
982</html>
Note: See TracBrowser for help on using the repository browser.