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

Last change on this file since 3059 was 3059, checked in by nmedfort, 6 years ago

updated bibliography

File size: 98.4 KB
1<html lang="en">
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<link rel="stylesheet" href="balisage-plain.css" type="text/css">
6<meta name="keywords" content="">
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>
12<html lang="en">
15<link rel="stylesheet" href="balisage-proceedings.css" type="text/css">
16<meta name="generator" content="Balisage Conference Proceedings XSLT (v1.2)">
17<script type="text/javascript">
18    function toggle(folderID) {
19      folder = document.getElementById("folder-"+folderID);
20      icon = document.getElementById("icon-"+folderID)
21      // need to:
22      //   switch between 'none' and 'block'
23      //   switch between collapse and expand icons
24      if ( != "block") {
25 = "block";
26        icon.src = "minus.png" ;
27        icon.alt = "collapse" ;
28      }
29      else {
30 = "none";
31        icon.src = "plus.png" ;
32        icon.alt = "expand" ;
33      };
34      return;
35    }
37   function hidecite(citeID) {
38     cite = document.getElementById(citeID);
39 = "none";
40     return;
41   }
43   function showcite(citeID,anchorID) {
44     cite = document.getElementById(citeID);
46     citeLeft =;
47     citeTop =;
49     if (citeLeft != (getLeft(anchorID)+"px") ||
50         citeTop != (getTop(anchorID)+"px")) {
51 = "none";
52     }
54     if ( != "table-cell") {
55        movebox(citeID, anchorID);
56 = "table-cell";
57     }
58     else {
59 = "none";
60     };
61     return;
62   }
64   function movebox(citeID, anchorID) {
66     cite = document.getElementById(citeID);
68     // alert(cite.offsetWidth + " by " + cite.offsetHeight)
70     horizontalOffset = getLeft(anchorID);
71     // horizontalOffset = (inMain(anchorID)) ?
72     // (horizontalOffset - 260) : (horizontalOffset + 20)
73     // (horizontalOffset - (20 + cite.offsetWidth)) : (horizontalOffset + 20)
75     verticalOffset = getTop(anchorID);
76     // verticalOffset = (inMain(anchorID)) ?
77     // (verticalOffset - 20) : (verticalOffset + 20)
78     // (verticalOffset - (20 + cite.offsetHeight)) : (verticalOffset + 20)
80     /*
81     horizontalOffset = getAbsoluteLeft(anchorID) - getScrollLeft(anchorID) + 20;
82     if (inMain(anchorID)) {
83       horizontalOffset = horizontalOffset - 300;
84     }
85     verticalOffset = getAbsoluteTop(anchorID) - getScrollTop(anchorID) - 40;
86     if (inMain(anchorID)) {
87       verticalOffset = verticalOffset - 300;
88     }
89     */
91 = horizontalOffset + "px";
92 = verticalOffset + "px";
93   }
95   function getLeft(objectID) {
96     var left = getAbsoluteLeft(objectID) - getScrollLeft(objectID);
97     left = (inMain(objectID)) ? (left - 260) : (left + 20)   
98     return left;
99   }
101   function getTop(objectID) {
102     var top = getAbsoluteTop(objectID) - getScrollTop(objectID);
103     top = (inMain(objectID)) ? (top - 50) : (top + 20)
104     return top;     
105   }
107   function getAbsoluteLeft(objectId) {
108   // Get an object left position from the upper left viewport corner
109     o = document.getElementById(objectId)
110     oLeft = o.offsetLeft            // Get left position from the parent object
111     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
112       oParent = o.offsetParent    // Get parent object reference
113       oLeft += oParent.offsetLeft // Add parent left position
114       o = oParent
115      }
116    return oLeft
117    }
119    function getAbsoluteTop(objectId) {
120    // Get an object top position from the upper left viewport corner
121      o = document.getElementById(objectId)
122      oTop = o.offsetTop            // Get top position from the parent object
123      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
124        oParent = o.offsetParent  // Get parent object reference
125        oTop += oParent.offsetTop // Add parent top position
126        o = oParent
127      }
128    return oTop
129    }
131   function getScrollLeft(objectId) {
132     // Get a left scroll position
133     o = document.getElementById(objectId)
134     oLeft = o.scrollLeft            // Get left position from the parent object
135     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
136       oParent = o.offsetParent    // Get parent object reference
137       oLeft += oParent.scrollLeft // Add parent left position
138       o = oParent
139      }
140    return oLeft
141    }
143    function getScrollTop(objectId) {
144    // Get a right scroll position
145      o = document.getElementById(objectId)
146      oTop = o.scrollTop            // Get top position from the parent object
147      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
148        oParent = o.offsetParent  // Get parent object reference
149        oTop += oParent.scrollTop // Add parent top position
150        o = oParent
151      }
152    return oTop
153    }
155    function inMain(objectId) {
156    // returns true if in div#main
157      o = document.getElementById(objectId)
158      while(o.parentNode != null) { // Parse the parent hierarchy up to div#main
159        oParent = o.parentNode
160        if ( == "main") { return true; }
161        o = oParent;
162      }
163    return false;
164    }
167   /*
168   function showcite(citeID) {
169      cite = document.getElementById(citeID);
170      if ( != "table-cell") {
171 = "table-cell";
172      }
173      else {
174 = "none";
175      };
176      return;
177    }
178    */
180      </script>
183<div class="inline-citation" id="cite-XMLChip09" style="display:none;width: 240px">
184<a class="quiet" href="javascript:hidecite('cite-XMLChip09')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Leventhal, Michael and
185         Eric Lemoine 2009. The XML chip at 6 years. Proceedings of International Symposium on
186         Processing XML Efficiently 2009, Montréal.</p>
188<div class="inline-citation" id="cite-Datapower09" style="display:none;width: 240px">
189<a class="quiet" href="javascript:hidecite('cite-Datapower09')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Salz, Richard,
190         Heather Achilles, and David Maze. 2009. Hardware and software trade-offs in the IBM
191         DataPower XML XG4 processor card. Proceedings of International Symposium on Processing XML
192         Efficiently 2009, Montréal.</p>
194<div class="inline-citation" id="cite-PPoPP08" style="display:none;width: 240px">
195<a class="quiet" href="javascript:hidecite('cite-PPoPP08')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D. 2007. A Case Study
196         in SIMD Text Processing with Parallel Bit Streams UTF-8 to UTF-16 Transcoding. Proceedings
197         of 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2008, Salt
198         Lake City, Utah. On the Web at <a href="" class="link" target="_new"></a>.</p>
200<div class="inline-citation" id="cite-CASCON08" style="display:none;width: 240px">
201<a class="quiet" href="javascript:hidecite('cite-CASCON08')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D.,
202         Kenneth S Herdy, and Dan Lin. 2008. High Performance XML Parsing Using Parallel Bit Stream
203         Technology. Proceedings of CASCON 2008. 13th ACM SIGPLAN Symposium on Principles and
204         Practice of Parallel Programming 2008, Toronto.</p>
206<div class="inline-citation" id="cite-SVGOpen08" style="display:none;width: 240px">
207<a class="quiet" href="javascript:hidecite('cite-SVGOpen08')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Herdy, Kenneth
208         S., Robert D. Cameron and David S. Burggraf. 2008. High Performance GML to SVG
209         Transformation for the Visual Presentation of Geographic Data in Web-Based Mapping Systems.
210         Proceedings of SVG Open 6th International Conference on Scalable Vector Graphics,
211         Nuremburg. On the Web at
212            <a href="" class="link" target="_new"></a>.</p>
214<div class="inline-citation" id="cite-Ross06" style="display:none;width: 240px">
215<a class="quiet" href="javascript:hidecite('cite-Ross06')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Ross, Kenneth A. 2006. Efficient hash
216         probes on modern processors. Proceedings of ICDE, 2006. ICDE 2006, Atlanta. On the Web at
217            <a href="" class="link" target="_new"></a>.</p>
219<div class="inline-citation" id="cite-ASPLOS09" style="display:none;width: 240px">
220<a class="quiet" href="javascript:hidecite('cite-ASPLOS09')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Cameron, Robert D. and Dan
221         Lin. 2009. Architectural Support for SWAR Text Processing with Parallel Bit Streams: The
222         Inductive Doubling Principle. Proceedings of ASPLOS 2009, Washington, DC.</p>
224<div class="inline-citation" id="cite-Wu08" style="display:none;width: 240px">
225<a class="quiet" href="javascript:hidecite('cite-Wu08')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Wu, Yu, Qi Zhang, Zhiqiang Yu and
226         Jianhui Li. 2008. A Hybrid Parallel Processing for XML Parsing and Schema Validation.
227         Proceedings of Balisage 2008, Montréal. On the Web at
228            <a href="" class="link" target="_new"></a>.</p>
230<div class="inline-citation" id="cite-u8u16" style="display:none;width: 240px">
231<a class="quiet" href="javascript:hidecite('cite-u8u16')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">u8u16 - A High-Speed UTF-8 to UTF-16
232         Transcoder Using Parallel Bit Streams Technical Report 2007-18. 2007. School of Computing
233         Science Simon Fraser University, June 21 2007.</p>
235<div class="inline-citation" id="cite-XML10" style="display:none;width: 240px">
236<a class="quiet" href="javascript:hidecite('cite-XML10')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Extensible Markup Language (XML) 1.0 (Fifth
237         Edition) W3C Recommendation 26 November 2008. On the Web at
238            <a href="" class="link" target="_new"></a>.</p>
240<div class="inline-citation" id="cite-Unicode" style="display:none;width: 240px">
241<a class="quiet" href="javascript:hidecite('cite-Unicode')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">The Unicode Consortium. 2009. On the Web at
242            <a href="" class="link" target="_new"></a>.</p>
244<div class="inline-citation" id="cite-Pex06" style="display:none;width: 240px">
245<a class="quiet" href="javascript:hidecite('cite-Pex06')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex"> Hilewitz, Y. and Ruby B. Lee.
246         2006. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit
247         Instructions. Proceedings of the IEEE 17th International Conference on Application-Specific
248         Systems, Architectures and Processors (ASAP), pp. 65-72, September 11-13, 2006.</p>
250<div class="inline-citation" id="cite-InfoSet" style="display:none;width: 240px">
251<a class="quiet" href="javascript:hidecite('cite-InfoSet')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">XML Information Set (Second Edition) W3C
252         Recommendation 4 February 2004. On the Web at
253         <a href="" class="link" target="_new"></a>.</p>
255<div class="inline-citation" id="cite-Saxon" style="display:none;width: 240px">
256<a class="quiet" href="javascript:hidecite('cite-Saxon')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">SAXON The XSLT and XQuery Processor. On the Web
257         at <a href="" class="link" target="_new"></a>.</p>
259<div class="inline-citation" id="cite-Kay08" style="display:none;width: 240px">
260<a class="quiet" href="javascript:hidecite('cite-Kay08')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex"> Kay, Michael Y. 2008. Ten Reasons Why Saxon
261         XQuery is Fast, IEEE Data Engineering Bulletin, December 2008.</p>
263<div class="inline-citation" id="cite-AElfred" style="display:none;width: 240px">
264<a class="quiet" href="javascript:hidecite('cite-AElfred')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex"> The Ælfred XML Parser. On the Web at
265            <a href="" class="link" target="_new"></a>.</p>
267<div class="inline-citation" id="cite-JNI" style="display:none;width: 240px">
268<a class="quiet" href="javascript:hidecite('cite-JNI')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">Hitchens, Ron. Java NIO. O'Reilly, 2002.</p>
270<div class="inline-citation" id="cite-Expat" style="display:none;width: 240px">
271<a class="quiet" href="javascript:hidecite('cite-Expat')" style="font-size:90%"><img src="eks.png" alt="[x]" style="float:right;clear:both;margin:1px"></a><p style="margin:0ex">The Expat XML Parser.
272            <a href="" class="link" target="_new"></a>.</p>
274<div id="mast"><div class="content">
275<h2 class="article-title" id="idp66448"></h2>
276<div class="author">
277<h3 class="author">Nigel Medforth</h3>
278<div class="affiliation">
279<p class="jobtitle">Developer</p>
280<p class="orgname">International Characters Inc.</p>
282<div class="affiliation">
283<p class="jobtitle">Graduate Student, School of Computing Science</p>
284<p class="orgname">Simon Fraser University </p>
286<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
288<div class="author">
289<h3 class="author">Dan Lin</h3>
290<div class="affiliation">
291<p class="jobtitle">Graduate Student, School of Computing Science</p>
292<p class="orgname">Simon Fraser University </p>
294<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
296<div class="author">
297<h3 class="author">Kenneth Herdy</h3>
298<div class="affiliation">
299<p class="jobtitle">Graduate Student, School of Computing Science</p>
300<p class="orgname">Simon Fraser University </p>
302<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
304<div class="author">
305<h3 class="author">Rob Cameron</h3>
306<div class="affiliation">
307<p class="jobtitle">Professor of Computing Science</p>
308<p class="orgname">Simon Fraser University</p>
310<div class="affiliation">
311<p class="jobtitle">Chief Technology Officer</p>
312<p class="orgname">International Characters, Inc.</p>
314<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
316<div class="author">
317<h3 class="author">Arrvindh Shriraman</h3>
318<div class="affiliation">
319<p class="jobtitle"></p>
320<p class="orgname"></p>
322<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:"></a>&gt;</code></h5>
324<div class="mast-box">
325<p class="title"><a href="javascript:toggle('idp67568')" class="quiet"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp67568"></a> <span onclick="javascript:toggle('idp67568');return true">Abstract</span></p>
326<div class="folder" id="folder-idp67568" style="display:none"><p id="idp67872">Prior research on the acceleration of XML processing using SIMD and multi-core
327            parallelism has lead to a number of interesting research prototypes. This work
328            investigates the extent to which the techniques underlying these prototypes could result
329            in systematic performance benefits when fully integrated into a commercial XML parser.
330            The widely used Xerces-C++ parser of the Apache Software Foundation was chosen as the
331            foundation for the study. A systematic restructuring of the parser was undertaken, while
332            maintaining the existing API for application programmers. Using SIMD techniques alone,
333            an increase in parsing speed of at least 50% was observed in a range of applications.
334            When coupled with pipeline parallelism on dual core processors, improvements of 2x and
335            beyond were realized. </p></div>
339<div class="toc">
340<p><b>Table of Contents</b></p>
342<dt><span class="section"><a href="#idp275776" class="toc">Introduction</a></span></dt>
343<dt><span class="section"><a href="#background" class="toc">Background</a></span></dt>
345<dt><span class="section"><a href="#background-xerces" class="toc">Xerces C++ Structure</a></span></dt>
346<dt><span class="section"><a href="#idp343136" class="toc">The Parabix Framework</a></span></dt>
347<dt><span class="section"><a href="#idp435712" class="toc">Sequential vs. Parallel Paradigm</a></span></dt>
349<dt><span class="section"><a href="#architecture" class="toc">Architecture</a></span></dt>
351<dt><span class="section"><a href="#idp441104" class="toc">Overview</a></span></dt>
352<dt><span class="section"><a href="#character-set-adapter" class="toc">Character Set Adapters</a></span></dt>
353<dt><span class="section"><a href="#par-filter" class="toc">Combined Parallel Filtering</a></span></dt>
354<dt><span class="section"><a href="#contentstream" class="toc">Content Stream</a></span></dt>
355<dt><span class="section"><a href="#namespace-handling" class="toc">Namespace Handling</a></span></dt>
356<dt><span class="section"><a href="#errorhandling" class="toc">Error Handling</a></span></dt>
358<dt><span class="section"><a href="#multithread" class="toc">Multithreading with Pipeline Parallelism</a></span></dt>
359<dt><span class="section"><a href="#performance" class="toc">Performance</a></span></dt>
361<dt><span class="section"><a href="#idp600160" class="toc">Xerces C++ SAXCount</a></span></dt>
362<dt><span class="section"><a href="#idp626688" class="toc">GML2SVG</a></span></dt>
364<dt><span class="section"><a href="#conclusion" class="toc">Conclusion and Future Work</a></span></dt>
367<div class="mast-box">
368<p class="title"><a href="javascript:toggle('idp69296')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp69296"></a> <span onclick="javascript:toggle('idp69296');return true">Nigel Medforth</span></p>
369<div class="folder" id="folder-idp69296" style="display:none">
370<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
371<div class="affiliation">
372<p class="jobtitle">Developer</p>
373<p class="orgname">International Characters Inc.</p>
375<div class="affiliation">
376<p class="jobtitle">Graduate Student, School of Computing Science</p>
377<p class="orgname">Simon Fraser University </p>
379<div class="personblurb">
380<p id="idp51616">Nigel Medforth is a M.Sc. student at Simon Fraser University and the lead
381               developer of icXML. He earned a Bachelor of Technology in Information Technology at
382               Kwantlen Polytechnic University in 2009 and was awarded the Dean’s Medal for
383               Outstanding Achievement.</p>
384<p id="idp52624">Nigel is currently researching ways to leverage both the Parabix framework and
385               stream-processing models to further accelerate XML parsing within icXML.</p>
389<div class="mast-box">
390<p class="title"><a href="javascript:toggle('idp56288')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp56288"></a> <span onclick="javascript:toggle('idp56288');return true">Dan Lin</span></p>
391<div class="folder" id="folder-idp56288" style="display:none">
392<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
393<div class="affiliation">
394<p class="jobtitle">Graduate Student, School of Computing Science</p>
395<p class="orgname">Simon Fraser University </p>
397<div class="personblurb"><p id="idp58000">Dan Lin is a Ph.D student at Simon Fraser University. She earned a Master of Science
398             in Computing Science at Simon Fraser University in 2010. Her research focus on on high
399             performance algorithms that exploit parallelization strategies on various multicore platforms.
400           </p></div>
403<div class="mast-box">
404<p class="title"><a href="javascript:toggle('idp60560')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp60560"></a> <span onclick="javascript:toggle('idp60560');return true">Kenneth Herdy</span></p>
405<div class="folder" id="folder-idp60560" style="display:none">
406<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
407<div class="affiliation">
408<p class="jobtitle">Graduate Student, School of Computing Science</p>
409<p class="orgname">Simon Fraser University </p>
411<div class="personblurb">
412<p id="idp62288"> Ken Herdy completed an Advanced Diploma of Technology in Geographical Information
413               Systems at the British Columbia Institute of Technology in 2003 and earned a Bachelor
414               of Science in Computing Science with a Certificate in Spatial Information Systems at
415               Simon Fraser University in 2005. </p>
416<p id="idp262528"> Ken is currently pursuing PhD studies in Computing Science at Simon Fraser
417               University with industrial scholarship support from the Natural Sciences and
418               Engineering Research Council of Canada, the Mathematics of Information Technology and
419               Complex Systems NCE, and the BC Innovation Council. His research focus is an analysis
420               of the principal techniques that may be used to improve XML processing performance in
421               the context of the Geography Markup Language (GML). </p>
425<div class="mast-box">
426<p class="title"><a href="javascript:toggle('idp265264')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp265264"></a> <span onclick="javascript:toggle('idp265264');return true">Rob Cameron</span></p>
427<div class="folder" id="folder-idp265264" style="display:none">
428<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
429<div class="affiliation">
430<p class="jobtitle">Professor of Computing Science</p>
431<p class="orgname">Simon Fraser University</p>
433<div class="affiliation">
434<p class="jobtitle">Chief Technology Officer</p>
435<p class="orgname">International Characters, Inc.</p>
437<div class="personblurb"><p id="idp266928">Dr. Rob Cameron is Professor of Computing Science and Associate Dean of Applied
438               Sciences at Simon Fraser University. His research interests include programming
439               language and software system technology, with a specific focus on high performance
440               text processing using SIMD and multicore parallelism. He is the developer of the REX
441               XML shallow parser as well as the parallel bit stream (Parabix) framework for SIMD
442               text processing. </p></div>
446<div id="navbar"></div>
447<div id="balisage-header" style="background-color: #6699CC">
448<a class="quiet" href=""><img style="float:right;border:none" alt="Balisage logo" height="130" src=""></a><h2 class="page-header">Balisage: The Markup Conference</h2>
449<h1 class="page-header">Proceedings preview</h1>
451<div id="main">
452<div class="article">
453<h2 class="article-title" id="idp66448"></h2>
454<div class="section" id="idp275776">
455<h2 class="title" style="clear: both">Introduction</h2>
456<p id="idp276416">   
457        Parallelization and acceleration of XML parsing is a widely
458        studied problem that has seen the development of a number
459        of interesting research prototypes using both SIMD and
460        multicore parallelism.   Most works have investigated
461        data parallel solutions on multicore
462        architectures using various strategies to break input
463        documents into segments that can be allocated to different cores.
464        For example, one possibility for data
465        parallelization is to add a pre-parsing step to compute
466        a skeleton tree structure of an  XML document \cite{GRID2006}.
467        The parallelization of the pre-parsing stage itself can be tackled with
468        state machines \cite{E-SCIENCE2007, IPDPS2008}.
469        Methods without pre-parsing have used speculation \cite{HPCC2011} or post-processing that
470        combines the partial results \cite{ParaDOM2009}.
471        A hybrid technique that combines data and pipeline parallelism was proposed to
472        hide the latency of a "job" that has to be done sequentially \cite{ICWS2008}.
473      </p>
474<p id="idp277808">
475        Fewer efforts have investigated SIMD parallelism, although this approach
476        has the potential advantage of improving single core performance as well
477        as offering savings in energy consumption \cite{HPCA2012}.
478        Intel introduced specialized SIMD string processing instructions in the SSE 4.2 instruction set extension
479        and showed how they can be used to improve the performance of XML parsing \cite{XMLSSE42}.
480        The Parabix framework uses generic SIMD extensions and bit parallel methods to
481        process hundreds of XML input characters simultaneously \cite{Cameron2009, cameron-EuroPar2011}.
482        Parabix prototypes have also combined SIMD methods with thread-level parallelism to
483        achieve further acceleration on multicore systems \cite{HPCA2012}.
484      </p>
485<p id="idp279712">
486        In this paper, we move beyond research prototypes to consider
487        the detailed integration of both SIMD and multicore parallelism into the
488        Xerces-C++ parser of the Apache Software Foundation, an existing
489        standards-compliant open-source parser that is widely used
490        in commercial practice.    The challenge of this work is
491        to parallelize the Xerces parser in such a way as to
492        preserve the existing APIs as well as offering worthwhile
493        end-to-end acceleration of XML processing.   
494        To achieve the best results possible, we undertook
495        a nine-month comprehensive restructuring of the Xerces-C++ parser,
496        seeking to expose as many critical aspects of XML parsing
497        as possible for parallelization, the result of which we named icXML.   
498        Overall, we employed Parabix-style methods of transcoding, tokenization
499        and tag parsing, parallel string comparison methods in symbol
500        resolution, bit parallel methods in namespace processing,
501        as well as staged processing using pipeline parallelism to take advantage of
502        multiple cores.
503      </p>
504<p id="idp281152">
505        The remainder of this paper is organized as follows.   
506          <a class="xref" href="#background" title="Background">section “Background”</a> discusses the structure of the Xerces and Parabix XML parsers and the fundamental
507        differences between the two parsing models.   
508        <a class="xref" href="#architecture" title="Architecture">section “Architecture”</a> then presents the icXML design based on a restructured Xerces architecture to
509        incorporate SIMD parallelism using Parabix methods.   
510        <a class="xref" href="#multithread" title="Multithreading with Pipeline Parallelism">section “Multithreading with Pipeline Parallelism”</a> moves on to consider the multithreading of the icXML architecture
511        using the pipeline parallelism model. 
512        <a class="xref" href="#performance" title="Performance">section “Performance”</a> analyzes the performance of both the single-threaded and
513        multi-threaded versions of icXML in comparison to original Xerces,
514        demonstrating substantial end-to-end acceleration of
515        a GML-to-SVG translation application written against the Xerces API.
516          <a class="xref" href="#conclusion" title="Conclusion and Future Work">section “Conclusion and Future Work”</a> concludes the paper with a discussion of future work and the potential for
517        applying the techniques discussed herein in other application domains.
518      </p>
520<div class="section" id="background">
521<h2 class="title" style="clear: both">Background</h2>
522<div class="section" id="background-xerces">
523<h3 class="title" style="clear: both">Xerces C++ Structure</h3>
524<p id="idp300432"> The Xerces C++ parser is a widely-used standards-conformant
525            XML parser produced as open-source software
526             by the Apache Software Foundation.
527            It features comprehensive support for a variety of character encodings both
528            commonplace (e.g., UTF-8, UTF-16) and rarely used (e.g., EBCDIC), support for multiple
529            XML vocabularies through the XML namespace mechanism, as well as complete
530            implementations of structure and data validation through multiple grammars declared
531            using either legacy DTDs (document type definitions) or modern XML Schema facilities.
532            Xerces also supports several APIs for accessing parser services, including event-based
533            parsing using either pull parsing or SAX/SAX2 push-style parsing as well as a DOM
534            tree-based parsing interface. </p>
535<p id="idp301696">
536            Xerces,
537            like all traditional parsers, processes XML documents sequentially a byte-at-a-time from
538            the first to the last byte of input data. Each byte passes through several processing
539            layers and is classified and eventually validated within the context of the document
540            state. This introduces implicit dependencies between the various tasks within the
541            application that make it difficult to optimize for performance. As a complex software
542              system, no one feature dominates the overall parsing performance. <a class="xref" href="#xerces-profile">Table I</a>
543            shows the execution time profile of the top ten functions in a
544            typical run. Even if it were possible, Amdahl's Law dictates that tackling any one of
545            these functions for parallelization in isolation would only produce a minute improvement
546            in performance. Unfortunately, early investigation into these functions found that
547            incorporating speculation-free thread-level parallelization was impossible and they were
548            already performing well in their given tasks; thus only trivial enhancements were
549            attainable. In order to obtain a systematic acceleration of Xerces, it should be
550            expected that a comprehensive restructuring is required, involving all aspects of the
551            parser. </p>
552<div class="table-wrapper" id="xerces-profile">
553<p class="title">Table I</p>
554<div class="caption"><p id="idm824832">Execution Time of Top 10 Xerces Functions</p></div>
555<table class="table" xml:id="xerces-profile">
556<colgroup span="1">
557<col align="left" valign="top" span="1">
558<col align="left" valign="top" span="1">
561<th>Time (%) </th>
562<th> Function Name </th>
565<tr valign="top">
566<td>13.29       </td>
567<td>XMLUTF8Transcoder::transcodeFrom </td>
569<tr valign="top">
570<td>7.45        </td>
571<td>IGXMLScanner::scanCharData </td>
573<tr valign="top">
574<td>6.83        </td>
575<td>memcpy </td>
577<tr valign="top">
578<td>5.83        </td>
579<td>XMLReader::getNCName </td>
581<tr valign="top">
582<td>4.67        </td>
583<td>IGXMLScanner::buildAttList </td>
585<tr valign="top">
586<td>4.54        </td>
587<td>RefHashTableO&lt;&gt;::findBucketElem </td>
589<tr valign="top">
590<td>4.20        </td>
591<td>IGXMLScanner::scanStartTagNS </td>
593<tr valign="top">
594<td>3.75        </td>
595<td>ElemStack::mapPrefixToURI </td>
597<tr valign="top">
598<td>3.58        </td>
599<td>ReaderMgr::getNextChar </td>
601<tr valign="top">
602<td>3.20        </td>
603<td>IGXMLScanner::basicAttrValueScan </td>
609<div class="section" id="idp343136">
610<h3 class="title" style="clear: both">The Parabix Framework</h3>
611<p id="idp343808"> The Parabix (parallel bit stream) framework is a transformative approach to XML
612            parsing (and other forms of text processing.) The key idea is to exploit the
613            availability of wide SIMD registers (e.g., 128-bit) in commodity processors to represent
614            data from long blocks of input data by using one register bit per single input byte. To
615            facilitate this, the input data is first transposed into a set of basis bit streams.
616              For example, <a class="xref" href="#xml-bytes">Table II</a> shows  the ASCII bytes for the string "<code class="code">b7&lt;A</code>" with
617                the corresponding  8 basis bit streams, b<sub>0</sub> through  b<sub>7</sub> shown in  <a class="xref" href="#xml-bits">Table III</a>.
620            Boolean-logic operations\footnote{∧, \√ and ¬ denote the
621            boolean AND, OR and NOT operators.} are used to classify the input bits into a set of
622               <span class="ital">character-class bit streams</span>, which identify key
623            characters (or groups of characters) with a <code class="code">1</code>. For example, one of the
624            fundamental characters in XML is a left-angle bracket. A character is an
625               <code class="code">'&lt;' if and only if
626               Â¬(b<sub>0</sub> âˆš b<sub>1</sub>)
627               âˆ§ (b<sub>2</sub> âˆ§ b<sub>3</sub>)
628               âˆ§ (b<sub>4</sub> âˆ§ b<sub>5</sub>)
629               âˆ§ ¬ (b<sub>6</sub> âˆš
630               b<sub>7</sub>) = 1</code>. Similarly, a character is numeric, <code class="code">[0-9]
631               if and only if ¬(b<sub>0</sub> âˆš
632               b<sub>1</sub>) ∧ (b<sub>2</sub> âˆ§
633                  b<sub>3</sub>) ∧ ¬(b<sub>4</sub>
634               âˆ§ (b<sub>5</sub> âˆš
635            b<sub>6</sub>))</code>. An important observation here is that ranges of
636            characters may require fewer operations than individual characters and
637             multiple
638            classes can share the classification cost. </p>
639<div class="table-wrapper" id="xml-bytes">
640<p class="title">Table II</p>
641<div class="caption"><p id="idp358432">XML Source Data</p></div>
642<table class="table" xml:id="xml-bytes">
643<colgroup span="1">
644<col align="right" valign="top" span="1">
645<col align="centre" valign="top" span="1">
646<col align="centre" valign="top" span="1">
647<col align="centre" valign="top" span="1">
648<col align="centre" valign="top" span="1">
652<td>String </td>
653<td> <code class="code">b</code> </td>
654<td> <code class="code">7</code> </td>
655<td> <code class="code">&lt;</code> </td>
656<td> <code class="code">A</code> </td>
659<td>ASCII </td>
660<td> <code class="code">0110001<span class="bold">0</span></code> </td>
661<td> <code class="code">0011011<span class="bold">1</span></code> </td>
662<td> <code class="code">0011110<span class="bold">0</span></code> </td>
663<td> <code class="code">0100000<span class="bold">1</span></code> </td>
668<div class="table-wrapper" id="xml-bits">
669<p class="title">Table III</p>
670<div class="caption"><p id="idp374704">8-bit ASCII Basis Bit Streams</p></div>
671<table class="table" xml:id="xml-bits">
672<colgroup span="1">
673<col align="centre" valign="top" span="1">
674<col align="centre" valign="top" span="1">
675<col align="centre" valign="top" span="1">
676<col align="centre" valign="top" span="1">
677<col align="centre" valign="top" span="1">
678<col align="centre" valign="top" span="1">
679<col align="centre" valign="top" span="1">
680<col align="centre" valign="top" span="1">
684<td> b<sub>0</sub> </td>
685<td> b<sub>1</sub> </td>
686<td> b<sub>2</sub> </td>
687<td> b<sub>3</sub>
689<td> b<sub>4</sub> </td>
690<td> b<sub>5</sub> </td>
691<td> b<sub>6</sub> </td>
692<td> b<sub>7</sub> </td>
695<td> <code class="code">0</code> </td>
696<td> <code class="code">1</code> </td>
697<td> <code class="code">1</code> </td>
698<td> <code class="code">0</code> </td>
699<td> <code class="code">0</code> </td>
700<td> <code class="code">0</code> </td>
701<td> <code class="code">1</code> </td>
702<td> <span class="bold"><code class="code">0</code></span> </td>
705<td> <code class="code">0</code> </td>
706<td> <code class="code">0</code> </td>
707<td> <code class="code">1</code> </td>
708<td> <code class="code">1</code> </td>
709<td> <code class="code">0</code> </td>
710<td> <code class="code">1</code> </td>
711<td> <code class="code">1</code> </td>
712<td> <span class="bold"><code class="code">1</code></span> </td>
715<td> <code class="code">0</code> </td>
716<td> <code class="code">0</code> </td>
717<td> <code class="code">1</code> </td>
718<td> <code class="code">1</code> </td>
719<td> <code class="code">1</code> </td>
720<td> <code class="code">1</code> </td>
721<td> <code class="code">0</code> </td>
722<td> <span class="bold"><code class="code">0</code></span> </td>
725<td> <code class="code">0</code> </td>
726<td> <code class="code">1</code> </td>
727<td> <code class="code">0</code> </td>
728<td> <code class="code">0</code> </td>
729<td> <code class="code">0</code> </td>
730<td> <code class="code">0</code> </td>
731<td> <code class="code">0</code> </td>
732<td> <span class="bold"><code class="code">1</code></span> </td>
737<p id="idp414416"> Consider, for example, the XML source data stream shown in the first line of <a class="xref" href="#derived">Table IV</a>.
738The remaining lines of this figure show
739            several parallel bit streams that are computed in Parabix-style parsing, with each bit
740            of each stream in one-to-one correspondence to the source character code units of the
741            input stream. For clarity, 1 bits are denoted with 1 in each stream and 0 bits are
742            represented as underscores. The first bit stream shown is that for the opening angle
743            brackets that represent tag openers in XML. The second and third streams show a
744            partition of the tag openers into start tag marks and end tag marks depending on the
745            character immediately following the opener (i.e., "<code class="code">/</code>") or
746            not. The remaining three lines show streams that can be computed in subsequent parsing
747            (using the technique of bitstream addition \cite{cameron-EuroPar2011}), namely streams
748            marking the element names, attribute names and attribute values of tags. </p>
749<div class="table-wrapper" id="derived">
750<p class="title">Table IV</p>
751<div class="caption"><p id="idp418560">XML Source Data and Derived Parallel Bit Streams</p></div>
752<table class="table" xml:id="derived">
753<colgroup span="1">
754<col align="centre" valign="top" span="1">
755<col align="left" valign="top" span="1">
759<td> Source Data </td>
760<td> <code class="code"> &lt;document&gt;fee&lt;element a1='fie' a2 = 'foe'&gt;&lt;/element&gt;fum&lt;/document&gt; </code>
764<td> Tag Openers </td>
765<td> <code class="code">1____________1____________________________1____________1__________</code>
769<td> Start Tag Marks </td>
770<td> <code class="code">_1____________1___________________________________________________</code>
774<td> End Tag Marks </td>
775<td> <code class="code">___________________________________________1____________1_________</code>
779<td> Empty Tag Marks </td>
780<td> <code class="code">__________________________________________________________________</code>
784<td> Element Names </td>
785<td> <code class="code">_11111111_____1111111_____________________________________________</code>
789<td> Attribute Names </td>
790<td> <code class="code">______________________11_______11_________________________________</code>
794<td> Attribute Values </td>
795<td> <code class="code">__________________________111________111__________________________</code>
801<p id="idp431488"> Two intuitions may help explain how the Parabix approach can lead to improved XML
802            parsing performance. The first is that the use of the full register width offers a
803            considerable information advantage over sequential byte-at-a-time parsing. That is,
804            sequential processing of bytes uses just 8 bits of each register, greatly limiting the
805            processor resources that are effectively being used at any one time. The second is that
806            byte-at-a-time loop scanning loops are actually often just computing a single bit of
807            information per iteration: is the scan complete yet? Rather than computing these
808            individual decision-bits, an approach that computes many of them in parallel (e.g., 128
809            bytes at a time using 128-bit registers) should provide substantial benefit. </p>
810<p id="idp432736"> Previous studies have shown that the Parabix approach improves many aspects of XML
811            processing, including transcoding \cite{Cameron2008}, character classification and
812            validation, tag parsing and well-formedness checking. The first Parabix parser used
813            processor bit scan instructions to considerably accelerate sequential scanning loops for
814            individual characters \cite{CameronHerdyLin2008}. Recent work has incorporated a method
815            of parallel scanning using bitstream addition \cite{cameron-EuroPar2011}, as well as
816            combining SIMD methods with 4-stage pipeline parallelism to further improve throughput
817            \cite{HPCA2012}. Although these research prototypes handled the full syntax of
818            schema-less XML documents, they lacked the functionality required by full XML parsers. </p>
819<p id="idp434864"> Commercial XML processors support transcoding of multiple character sets and can
820            parse and validate against multiple document vocabularies. Additionally, they provide
821            API facilities beyond those found in research prototypes, including the widely used SAX,
822            SAX2 and DOM interfaces. </p>
824<div class="section" id="idp435712">
825<h3 class="title" style="clear: both">Sequential vs. Parallel Paradigm</h3>
826<p id="idp436400"> Xerces—like all traditional XML parsers—processes XML documents
827            sequentially. Each character is examined to distinguish between the XML-specific markup,
828            such as a left angle bracket <code class="code">&lt;</code>, and the content held within the
829            document. As the parser progresses through the document, it alternates between markup
830            scanning, validation and content processing modes. </p>
831<p id="idp437968"> In other words, Xerces belongs to an equivalent class applications termed FSM
832            applications\footnote{ Herein FSM applications are considered software systems whose
833            behaviour is defined by the inputs, current state and the events associated with
834            transitions of states.}. Each state transition indicates the processing context of
835            subsequent characters. Unfortunately, textual data tends to be unpredictable and any
836            character could induce a state transition. </p>
837<p id="idp438880"> Parabix-style XML parsers utilize a concept of layered processing. A block of source
838            text is transformed into a set of lexical bitstreams, which undergo a series of
839            operations that can be grouped into logical layers, e.g., transposition, character
840            classification, and lexical analysis. Each layer is pipeline parallel and require
841            neither speculation nor pre-parsing stages\cite{HPCA2012}. To meet the API requirements
842            of the document-ordered Xerces output, the results of the Parabix processing layers must
843            be interleaved to produce the equivalent behaviour. </p>
846<div class="section" id="architecture">
847<h2 class="title" style="clear: both">Architecture</h2>
848<div class="section" id="idp441104">
849<h3 class="title" style="clear: both">Overview</h3>
850<p id="idp442160"> icXML is more than an optimized version of Xerces. Many components were grouped,
851            restructured and rearchitected with pipeline parallelism in mind. In this section, we
852            highlight the core differences between the two systems. As shown in Figure
853              <a class="xref" href="#xerces-arch" title="Xerces Architecture">Figure 1</a>, Xerces is comprised of five main modules: the transcoder, reader,
854            scanner, namespace binder, and validator. The <span class="ital">Transcoder</span> converts source data into UTF-16 before Xerces parses it as XML;
855            the majority of the character set encoding validation is performed as a byproduct of
856            this process. The <span class="ital">Reader</span> is responsible for the
857            streaming and buffering of all raw and transcoded (UTF-16) text. It tracks the current
858            line/column position,
860            performs line-break normalization and validates context-specific character set issues,
861            such as tokenization of qualified-names. The <span class="ital">Scanner</span>
862            pulls data through the reader and constructs the intermediate representation (IR) of the
863            document; it deals with all issues related to entity expansion, validates the XML
864            well-formedness constraints and any character set encoding issues that cannot be
865            completely handled by the reader or transcoder (e.g., surrogate characters, validation
866            and normalization of character references, etc.) The <span class="ital">Namespace
867               Binder</span> is a core piece of the element stack. It handles namespace scoping
868            issues between different XML vocabularies. This allows the scanner to properly select
869            the correct schema grammar structures. The <span class="ital">Validator</span>
870            takes the IR produced by the Scanner (and potentially annotated by the Namespace Binder)
871            and assesses whether the final output matches the user-defined DTD and schema grammar(s)
872            before passing it to the end-user. </p>
873<div class="figure" id="xerces-arch">
874<p class="title">Figure 1: Xerces Architecture</p>
875<div class="figure-contents">
876<div class="mediaobject" id="idp450128"><img alt="png image (xerces.png)" src="xerces.png" width="150cm"></div>
877<div class="caption"></div>
880<p id="idp452496"> In icXML functions are grouped into logical components. As shown in
881             <a class="xref" href="#xerces-arch" title="Xerces Architecture">Figure 1</a>, two major categories exist: (1) the Parabix Subsystem and (2) the
882            Markup Processor. All tasks in (1) use the Parabix Framework \cite{HPCA2012}, which
883            represents data as a set of parallel bitstreams. The <span class="ital">Character Set
884              Adapter</span>, discussed in <a class="xref" href="#character-set-adapter" title="Character Set Adapters">section “Character Set Adapters”</a>, mirrors
885            Xerces's Transcoder duties; however instead of producing UTF-16 it produces a set of
886              lexical bitstreams, similar to those shown in . These lexical
887            bitstreams are later transformed into UTF-16 in the Content Stream Generator, after
888            additional processing is performed. The first precursor to producing UTF-16 is the
889               <span class="ital">Parallel Markup Parser</span> phase. It takes the lexical
890            streams and produces a set of marker bitstreams in which a 1-bit identifies significant
891            positions within the input data. One bitstream for each of the critical piece of
892            information is created, such as the beginning and ending of start tags, end tags,
893            element names, attribute names, attribute values and content. Intra-element
894            well-formedness validation is performed as an artifact of this process. Like Xerces,
895            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
896            document position(s) through the use of an optimized population count algorithm,
897              described in <a class="xref" href="#errorhandling" title="Error Handling">section “Error Handling”</a>. From here, two data-independent
898            branches exist: the Symbol Resolver and Content Preparation Unit. </p>
899<p id="idp459328"> A typical XML file contains few unique element and attribute names—but
900            each of them will occur frequently. icXML stores these as distinct data structures,
901            called symbols, each with their own global identifier (GID). Using the symbol marker
902            streams produced by the Parallel Markup Parser, the <span class="ital">Symbol
903               Resolver</span> scans through the raw data to produce a sequence of GIDs, called
904            the <span class="ital">symbol stream</span>. </p>
905<p id="idp461984"> The final components of the Parabix Subsystem are the <span class="ital">Content
906               Preparation Unit</span> and <span class="ital">Content Stream
907            Generator</span>. The former takes the (transposed) basis bitstreams and selectively
908            filters them, according to the information provided by the Parallel Markup Parser, and
909            the latter transforms the filtered streams into the tagged UTF-16 <span class="ital">content stream</span>, discussed in <a class="xref" href="#contentstream" title="Content Stream">section “Content Stream”</a>. </p>
910<p id="idp465584"> Combined, the symbol and content stream form icXML's compressed IR of the XML
911            document. The <span class="ital">Markup Processor</span>~parses the IR to
912            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
913            would be too costly to perform in bit space, such as ensuring every start tag has a
914            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
915            that produces a series of URI identifiers (URI IDs), the <span class="ital">URI
916               stream</span>, which are associated with each symbol occurrence. This is
917                 discussed in <a class="xref" href="#namespace-handling" title="Namespace Handling">section “Namespace Handling”</a>. Finally, the <span class="ital">Validation</span> layer implements the Xerces's validator. However,
918            preprocessing associated with each symbol greatly reduces the work of this stage. </p>
919<div class="figure" id="icxml-arch">
920<p class="title">Figure 2: icXML Architecture</p>
921<div class="figure-contents">
922<div class="mediaobject" id="idp472048"><img alt="png image (icxml.png)" src="icxml.png" width="500cm"></div>
923<div class="caption"></div>
927<div class="section" id="character-set-adapter">
928<h3 class="title" style="clear: both">Character Set Adapters</h3>
929<p id="idp475536"> In Xerces, all input is transcoded into UTF-16 to simplify the parsing costs of
930            Xerces itself and provide the end-consumer with a single encoding format. In the
931            important case of UTF-8 to UTF-16 transcoding, the transcoding costs can be significant,
932            because of the need to decode and classify each byte of input, mapping variable-length
933            UTF-8 byte sequences into 16-bit UTF-16 code units with bit manipulation operations. In
934            other cases, transcoding may involve table look-up operations for each byte of input. In
935            any case, transcoding imposes at least a cost of buffer copying. </p>
936<p id="idp476592"> In icXML, however, the concept of Character Set Adapters (CSAs) is used to minimize
937            transcoding costs. Given a specified input encoding, a CSA is responsible for checking
938            that input code units represent valid characters, mapping the characters of the encoding
939            into the appropriate bitstreams for XML parsing actions (i.e., producing the lexical
940            item streams), as well as supporting ultimate transcoding requirements. All of this work
941            is performed using the parallel bitstream representation of the source input. </p>
942<p id="idp477568"> An important observation is that many character sets are an extension to the legacy
943            7-bit ASCII character set. This includes the various ISO Latin character sets, UTF-8,
944            UTF-16 and many others. Furthermore, all significant characters for parsing XML are
945            confined to the ASCII repertoire. Thus, a single common set of lexical item calculations
946            serves to compute lexical item streams for all such ASCII-based character sets. </p>
947<p id="idp478448"> A second observation is that—regardless of which character set is
948            used—quite often all of the characters in a particular block of input will be
949            within the ASCII range. This is a very simple test to perform using the bitstream
950            representation, simply confirming that the bit 0 stream is zero for the entire block.
951            For blocks satisfying this test, all logic dealing with non-ASCII characters can simply
952            be skipped. Transcoding to UTF-16 becomes trivial as the high eight bitstreams of the
953            UTF-16 form are each set to zero in this case. </p>
954<p id="idp480160"> A third observation is that repeated transcoding of the names of XML elements,
955            attributes and so on can be avoided by using a look-up mechanism. That is, the first
956            occurrence of each symbol is stored in a look-up table mapping the input encoding to a
957            numeric symbol ID. Transcoding of the symbol is applied at this time. Subsequent look-up
958            operations can avoid transcoding by simply retrieving the stored representation. As
959            symbol look up is required to apply various XML validation rules, there is achieves the
960            effect of transcoding each occurrence without additional cost. </p>
961<p id="idp481216"> The cost of individual character transcoding is avoided whenever a block of input is
962            confined to the ASCII subset and for all but the first occurrence of any XML element or
963            attribute name. Furthermore, when transcoding is required, the parallel bitstream
964            representation supports efficient transcoding operations. In the important case of UTF-8
965            to UTF-16 transcoding, the corresponding UTF-16 bitstreams can be calculated in bit
966            parallel fashion based on UTF-8 streams \cite{Cameron2008}, and all but the final bytes
967            of multi-byte sequences can be marked for deletion as discussed in the following
968            subsection. In other cases, transcoding within a block only need be applied for
969            non-ASCII bytes, which are conveniently identified by iterating through the bit 0 stream
970            using bit scan operations. </p>
972<div class="section" id="par-filter">
973<h3 class="title" style="clear: both">Combined Parallel Filtering</h3>
974<p id="idp483728"> As just mentioned, UTF-8 to UTF-16 transcoding involves marking all but the last
975            bytes of multi-byte UTF-8 sequences as positions for deletion. For example, the two
976            Chinese characters <code class="code">䜠奜</code> are represented as two
977            three-byte UTF-8 sequences <code class="code">E4 BD A0</code> and <code class="code">E5 A5 BD</code> while the
978            UTF-16 representation must be compressed down to the two code units <code class="code">4F60</code>
979            and <code class="code">597D</code>. In the bit parallel representation, this corresponds to a
980            reduction from six bit positions representing UTF-8 code units (bytes) down to just two
981            bit positions representing UTF-16 code units (double bytes). This compression may be
982            achieved by arranging to calculate the correct UTF-16 bits at the final position of each
983            sequence and creating a deletion mask to mark the first two bytes of each 3-byte
984            sequence for deletion. In this case, the portion of the mask corresponding to these
985            input bytes is the bit sequence <code class="code">110110</code>. Using this approach, transcoding
986            may then be completed by applying parallel deletion and inverse transposition of the
987            UTF-16 bitstreams\cite{Cameron2008}. </p>
988<p id="idp487856"> Rather than immediately paying the costs of deletion and transposition just for
989            transcoding, however, icXML defers these steps so that the deletion masks for several
990            stages of processing may be combined. In particular, this includes core XML requirements
991            to normalize line breaks and to replace character reference and entity references by
992            their corresponding text. In the case of line break normalization, all forms of line
993            breaks, including bare carriage returns (CR), line feeds (LF) and CR-LF combinations
994            must be normalized to a single LF character in each case. In icXML, this is achieved by
995            first marking CR positions, performing two bit parallel operations to transform the
996            marked CRs into LFs, and then marking for deletion any LF that is found immediately
997            after the marked CR as shown by the Pablo source code in
998              <a class="xref" href="#fig-LBnormalization">Figure 3</a>.
999              <div class="figure" id="fig-LBnormalization">
1000<p class="title">Figure 3</p>
1001<div class="figure-contents">
1002<div class="caption">Line Break Normalization Logic</div>
1003<pre class="programlisting" id="idp491888">
1004# XML 1.0 line-break normalization rules.
1005if lex.CR:
1006# Modify CR (#x0D) to LF (#x0A)
1007  u16lo.bit_5 ^= lex.CR
1008  u16lo.bit_6 ^= lex.CR
1009  u16lo.bit_7 ^= lex.CR
1010  CRLF = pablo.Advance(lex.CR) &amp; lex.LF
1011  callouts.delmask |= CRLF
1012# Adjust LF streams for line/column tracker
1013  lex.LF |= lex.CR
1014  lex.LF ^= CRLF
1018         </p>
1019<p id="idp493360"> In essence, the deletion masks for transcoding and for line break normalization each
1020            represent a bitwise filter; these filters can be combined using bitwise-or so that the
1021            parallel deletion algorithm need only be applied once. </p>
1022<p id="idp494016"> A further application of combined filtering is the processing of XML character and
1023            entity references. Consider, for example, the references <code class="code">&amp;</code> or
1024               <code class="code">&lt;</code>. which must be replaced in XML processing with the single
1025               <code class="code">&amp;</code> and <code class="code">&lt;</code> characters, respectively. The
1026            approach in icXML is to mark all but the first character positions of each reference for
1027            deletion, leaving a single character position unmodified. Thus, for the references
1028               <code class="code">&amp;</code> or <code class="code">&lt;</code> the masks <code class="code">01111</code> and
1029               <code class="code">011111</code> are formed and combined into the overall deletion mask. After the
1030            deletion and inverse transposition operations are finally applied, a post-processing
1031            step inserts the proper character at these positions. One note about this process is
1032            that it is speculative; references are assumed to generally be replaced by a single
1033            UTF-16 code unit. In the case, that this is not true, it is addressed in
1034            post-processing. </p>
1035<p id="idp498768"> The final step of combined filtering occurs during the process of reducing markup
1036            data to tag bytes preceding each significant XML transition as described in
1037              <a class="xref" href="#contentstream" title="Content Stream">section “Content Stream”</a>. Overall, icXML avoids separate buffer copying
1038            operations for each of the these filtering steps, paying the cost of parallel deletion
1039            and inverse transposition only once. Currently, icXML employs the parallel-prefix
1040            compress algorithm of Steele~\cite{HackersDelight} Performance is independent of the
1041            number of positions deleted. Future versions of icXML are expected to take advantage of
1042            the parallel extract operation~\cite{HilewitzLee2006} that Intel is now providing in its
1043            Haswell architecture. </p>
1045<div class="section" id="contentstream">
1046<h3 class="title" style="clear: both">Content Stream</h3>
1047<p id="idp501744"> A relatively-unique concept for icXML is the use of a filtered content stream.
1048            Rather that parsing an XML document in its original format, the input is transformed
1049            into one that is easier for the parser to iterate through and produce the sequential
1050            output. In , the source data
1052            is transformed into
1054            through the parallel filtering algorithm, described in <a class="xref" href="#par-filter" title="Combined Parallel Filtering">section “Combined Parallel Filtering”</a>. </p>
1055<p id="idp504928"> Combined with the symbol stream, the parser traverses the content stream to
1056            effectively reconstructs the input document in its output form. The initial <span class="ital">0</span> indicates an empty content string. The following
1057               <code class="code">&gt;</code> indicates that a start tag without any attributes is the first
1058            element in this text and the first unused symbol, <code class="code">document</code>, is the element
1059            name. Succeeding that is the content string <code class="code">fee</code>, which is null-terminated
1060            in accordance with the Xerces API specification. Unlike Xerces, no memory-copy
1061            operations are required to produce these strings, which as
1062              <a class="xref" href="#xerces-profile">Table I</a> shows accounts for 6.83% of Xerces's execution time.
1063            Additionally, it is cheap to locate the terminal character of each string: using the
1064            String End bitstream, the Parabix Subsystem can effectively calculate the offset of each
1065            null character in the content stream in parallel, which in turn means the parser can
1066            directly jump to the end of every string without scanning for it. </p>
1067<p id="idp509008"> Following <code class="code">'fee'</code> is a <code class="code">=</code>, which marks the
1068            existence of an attribute. Because all of the intra-element was performed in the Parabix
1069            Subsystem, this must be a legal attribute. Since attributes can only occur within start
1070            tags and must be accompanied by a textual value, the next symbol in the symbol stream
1071            must be the element name of a start tag, and the following one must be the name of the
1072            attribute and the string that follows the <code class="code">=</code> must be its value. However, the
1073            subsequent <code class="code">=</code> is not treated as an independent attribute because the parser
1074            has yet to read a <code class="code">&gt;</code>, which marks the end of a start tag. Thus only
1075            one symbol is taken from the symbol stream and it (along with the string value) is added
1076            to the element. Eventually the parser reaches a <code class="code">/</code>, which marks the
1077            existence of an end tag. Every end tag requires an element name, which means they
1078            require a symbol. Inter-element validation whenever an empty tag is detected to ensure
1079            that the appropriate scope-nesting rules have been applied. </p>
1081<div class="section" id="namespace-handling">
1082<h3 class="title" style="clear: both">Namespace Handling</h3>
1083<p id="idp514576"> In XML, namespaces prevents naming conflicts when multiple vocabularies are used
1084            together. It is especially important when a vocabulary application-dependant meaning,
1085            such as when XML or SVG documents are embedded within XHTML files. Namespaces are bound
1086            to uniform resource identifiers (URIs), which are strings used to identify specific
1087            names or resources. On line 1 in <a class="xref" href="#namespace-ex">Table V</a>, the <code class="code">xmlns</code>
1088            attribute instructs the XML processor to bind the prefix <code class="code">p</code> to the URI
1089               '<code class="code"></code>' and the default (empty) prefix to
1090               <code class="code"></code>. Thus to the XML processor, the <code class="code">title</code> on line 2
1091            and <code class="code">price</code> on line 4 both read as
1092            <code class="code">"":title</code> and
1093               <code class="code">"":price</code> respectively, whereas on line 3 and
1094            5, <code class="code">p:name</code> and <code class="code">price</code> are seen as
1095               <code class="code">"":name</code> and
1096               <code class="code">"":price</code>. Even though the actual element name
1097               <code class="code">price</code>, due to namespace scoping rules they are viewed as two
1098            uniquely-named items because the current vocabulary is determined by the namespace(s)
1099            that are in-scope. </p>
1100<div class="table-wrapper" id="namespace-ex">
1101<p class="title">Table V</p>
1102<div class="caption"><p id="idp523360">XML Namespace Example</p></div>
1103<table class="table" xml:id="namespace-ex">
1104<colgroup span="1">
1105<col align="centre" valign="top" span="1">
1106<col align="left" valign="top" span="1">
1110<td>1. </td>
1111<td>&lt;book xmlns:p="" xmlns=""&gt; </td>
1114<td>2. </td>
1115<td>  &lt;title&gt;BOOK NAME&lt;/title&gt; </td>
1118<td>3. </td>
1119<td>  &lt;p:name&gt;PUBLISHER NAME&lt;/p:name&gt; </td>
1122<td>4. </td>
1123<td>  &lt;price&gt;X&lt;/price&gt; </td>
1126<td>5. </td>
1127<td>  &lt;price xmlns=""&gt;Y&lt;/price&gt; </td>
1130<td>6. </td>
1131<td>&lt;/book&gt; </td>
1136<p id="idp532304"> In both Xerces and icXML, every URI has a one-to-one mapping to a URI ID. These
1137            persist for the lifetime of the application through the use of a global URI pool. Xerces
1138            maintains a stack of namespace scopes that is pushed (popped) every time a start tag
1139            (end tag) occurs in the document. Because a namespace declaration affects the entire
1140            element, it must be processed prior to grammar validation. This is a costly process
1141            considering that a typical namespaced XML document only comes in one of two forms: (1)
1142            those that declare a set of namespaces upfront and never change them, and (2) those that
1143            repeatedly modify the namespaces in predictable patterns. </p>
1144<p id="idp533440"> For that reason, icXML contains an independent namespace stack and utilizes bit
1145            vectors to cheaply perform
1146             When a prefix is
1147            declared (e.g., <code class="code">xmlns:p=""</code>), a namespace binding
1148            is created that maps the prefix (which are assigned Prefix IDs in the symbol resolution
1149            process) to the URI. Each unique namespace binding has a unique namespace id (NSID) and
1150            every prefix contains a bit vector marking every NSID that has ever been associated with
1151              it within the document. For example, in <a class="xref" href="#namespace-ex">Table V</a>, the prefix binding
1152            set of <code class="code">p</code> and <code class="code">xmlns</code> would be <code class="code">01</code> and
1153            <code class="code">11</code> respectively. To resolve the in-scope namespace binding for each prefix,
1154            a bit vector of the currently visible namespaces is maintained by the system. By ANDing
1155            the prefix bit vector with the currently visible namespaces, the in-scope NSID can be
1156            found using a bit-scan intrinsic. A namespace binding table, similar to
1157            <a class="xref" href="#namespace-binding">Table VI</a>, provides the actual URI ID. </p>
1158<div class="table-wrapper" id="namespace-binding">
1159<p class="title">Table VI</p>
1160<div class="caption"><p id="idp540032">Namespace Binding Table Example</p></div>
1161<table class="table" xml:id="namespace-binding">
1162<colgroup span="1">
1163<col align="centre" valign="top" span="1">
1164<col align="centre" valign="top" span="1">
1165<col align="centre" valign="top" span="1">
1166<col align="centre" valign="top" span="1">
1167<col align="centre" valign="top" span="1">
1170<th>NSID </th>
1171<th> Prefix </th>
1172<th> URI </th>
1173<th> Prefix ID </th>
1174<th> URI ID </th>
1178<td>0 </td>
1179<td> <code class="code"> p</code> </td>
1180<td> <code class="code"></code> </td>
1181<td> 0 </td>
1182<td> 0 </td>
1185<td>1 </td>
1186<td> <code class="code"> xmlns</code> </td>
1187<td> <code class="code"></code> </td>
1188<td> 1 </td>
1189<td> 1 </td>
1192<td>2 </td>
1193<td> <code class="code"> xmlns</code> </td>
1194<td> <code class="code"></code> </td>
1195<td> 1 </td>
1196<td> 0 </td>
1201<p id="idp556448">
1206         </p>
1207<p id="idp558352"> To ensure that scoping rules are adhered to, whenever a start tag is encountered,
1208            any modification to the currently visible namespaces is calculated and stored within a
1209            stack of bit vectors denoting the locally modified namespace bindings. When an end tag
1210            is found, the currently visible namespaces is XORed with the vector at the top of the
1211            stack. This allows any number of changes to be performed at each scope-level with a
1212            constant time.
1214         </p>
1216<div class="section" id="errorhandling">
1217<h3 class="title" style="clear: both">Error Handling</h3>
1218<p id="idp560784">
1220            Xerces outputs error messages in two ways: through the programmer API and as thrown
1221            objects for fatal errors. As Xerces parses a file, it uses context-dependant logic to
1222            assess whether the next character is legal; if not, the current state determines the
1223            type and severity of the error. icXML emits errors in the similar manner—but
1224            how it discovers them is substantially different. Recall that in Figure
1225            <a class="xref" href="#icxml-arch" title="icXML Architecture">Figure 2</a>, icXML is divided into two sections: the Parabix Subsystem and
1226            Markup Processor, each with its own system for detecting and producing error messages. </p>
1227<p id="idp563280"> Within the Parabix Subsystem, all computations are performed in parallel, a block at
1228            a time. Errors are derived as artifacts of bitstream calculations, with a 1-bit marking
1229            the byte-position of an error within a block, and the type of error is determined by the
1230            equation that discovered it. The difficulty of error processing in this section is that
1231            in Xerces the line and column number must be given with every error production. Two
1232            major issues exist because of this: (1) line position adheres to XML white-normalization
1233            rules; as such, some sequences of characters, e.g., a carriage return followed by a line
1234            feed, are counted as a single new line character. (2) column position is counted in
1235            characters, not bytes or code units; thus multi-code-unit code-points and surrogate
1236            character pairs are all counted as a single column position. Note that typical XML
1237            documents are error-free but the calculation of the line/column position is a constant
1238            overhead in Xerces.  To
1239            reduce this, icXML pushes the bulk cost of the line/column calculation to the occurrence
1240            of the error and performs the minimal amount of book-keeping necessary to facilitate it.
1241            icXML leverages the byproducts of the Character Set Adapter (CSA) module and amalgamates
1242            the information within the Line Column Tracker (LCT). One of the CSA's major
1243            responsibilities is transcoding an input text.
1244             During this process,
1245            white-space normalization rules are applied and multi-code-unit and surrogate characters
1246            are detected and validated. A <span class="ital">line-feed bitstream</span>,
1247            which marks the positions of the normalized new lines characters, is a natural
1248            derivative of this process. Using an optimized population count algorithm, the line
1249            count can be summarized cheaply for each valid block of text.
1250             Column position is more
1251            difficult to calculate. It is possible to scan backwards through the bitstream of new
1252            line characters to determine the distance (in code-units) between the position between
1253            which an error was detected and the last line feed. However, this distance may exceed
1254            than the actual character position for the reasons discussed in (2). To handle this, the
1255            CSA generates a <span class="ital">skip mask</span> bitstream by ORing together
1256            many relevant bitstreams, such as all trailing multi-code-unit and surrogate characters,
1257            and any characters that were removed during the normalization process. When an error is
1258            detected, the sum of those skipped positions is subtracted from the distance to
1259            determine the actual column number. </p>
1260<p id="idp568800"> The Markup Processor is a state-driven machine. As such, error detection within it
1261            is very similar to Xerces. However, reporting the correct line/column is a much more
1262            difficult problem. The Markup Processor parses the content stream, which is a series of
1263            tagged UTF-16 strings. Each string is normalized in accordance with the XML
1264            specification. All symbol data and unnecessary whitespace is eliminated from the stream;
1265            thus its impossible to derive the current location using only the content stream. To
1266            calculate the location, the Markup Processor borrows three additional pieces of
1267            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
1268            (code-unit) position of every datum that was suppressed from the source during the
1269            production of the content stream. Armed with these, it is possible to calculate the
1270            actual line/column using the same system as the Parabix Subsystem until the sum of the
1271            negated deletion mask stream is equal to the current position. </p>
1274<div class="section" id="multithread">
1275<h2 class="title" style="clear: both">Multithreading with Pipeline Parallelism</h2>
1276<p id="idp572336"> As discussed in section <a class="xref" href="#background-xerces" title="Xerces C++ Structure">section “Xerces C++ Structure”</a>, Xerces can be considered a FSM
1277         application. These are "embarrassingly
1278         sequential."\cite{Asanovic:EECS-2006-183} and notoriously difficult to
1279         parallelize. However, icXML is designed to organize processing into logical layers. In
1280         particular, layers within the Parabix Subsystem are designed to operate over significant
1281         segments of input data before passing their outputs on for subsequent processing. This fits
1282         well into the general model of pipeline parallelism, in which each thread is in charge of a
1283         single module or group of modules. </p>
1284<p id="idp574752"> The most straightforward division of work in icXML is to separate the Parabix Subsystem
1285         and the Markup Processor into distinct logical layers into two separate stages. The
1286         resultant application, <span class="ital">icXML-p</span>, is a course-grained
1287         software-pipeline application. In this case, the Parabix Subsystem thread
1288               <code class="code">T<sub>1</sub></code> reads 16k of XML input <code class="code">I</code> at a
1289         time and produces the content, symbol and URI streams, then stores them in a pre-allocated
1290         shared data structure <code class="code">S</code>. The Markup Processor thread
1291            <code class="code">T<sub>2</sub></code> consumes <code class="code">S</code>, performs well-formedness
1292         and grammar-based validation, and the provides parsed XML data to the application through
1293         the Xerces API. The shared data structure is implemented using a ring buffer, where every
1294         entry contains an independent set of data streams. In the examples of
1295           <a class="xref" href="#threads_timeline1" title="Thread Balance in Two-Stage Pipelines: Stage 1 Dominant">Figure 4</a>, the ring buffer has four entries. A
1296         lock-free mechanism is applied to ensure that each entry can only be read or written by one
1297         thread at the same time. In  <a class="xref" href="#threads_timeline1" title="Thread Balance in Two-Stage Pipelines: Stage 1 Dominant">Figure 4</a> the processing time of
1298               <code class="code">T<sub>1</sub></code> is longer than
1299         <code class="code">T<sub>2</sub></code>; thus <code class="code">T<sub>2</sub></code> always
1300         waits for <code class="code">T<sub>1</sub></code> to write to the shared memory. 
1301         <a class="xref" href="#threads_timeline2" title="Thread Balance in Two-Stage Pipelines: Stage 2 Dominant">Figure 5</a> illustrates the scenario in which
1302         <code class="code">T<sub>1</sub></code> is faster and must wait for
1303            <code class="code">T<sub>2</sub></code> to finish reading the shared data before it can
1304         reuse the memory space. </p>
1305<p id="idp585824">
1306        <div class="figure" id="threads_timeline1">
1307<p class="title">Figure 4: Thread Balance in Two-Stage Pipelines: Stage 1 Dominant</p>
1308<div class="figure-contents"><div class="mediaobject" id="idp587152"><img alt="png image (threads_timeline1.png)" src="threads_timeline1.png" width="500cm"></div></div>
1310        <div class="figure" id="threads_timeline2">
1311<p class="title">Figure 5: Thread Balance in Two-Stage Pipelines: Stage 2 Dominant</p>
1312<div class="figure-contents"><div class="mediaobject" id="idp590160"><img alt="png image (threads_timeline2.png)" src="threads_timeline2.png" width="500cm"></div></div>
1314      </p>
1315<p id="idp592192"> Overall, our design is intended to benefit a range of applications. Conceptually, we
1316         consider two design points. The first, the parsing performed by the Parabix Subsystem
1317         dominates at 67% of the overall cost, with the cost of application processing (including
1318         the driver logic within the Markup Processor) at 33%. The second is almost the opposite
1319         scenario, the cost of application processing dominates at 60%, while the cost of XML
1320         parsing represents an overhead of 40%. </p>
1321<p id="idp593104"> Our design is predicated on a goal of using the Parabix framework to achieve a 50% to
1322         100% improvement in the parsing engine itself. In a best case scenario, a 100% improvement
1323         of the Parabix Subsystem for the design point in which XML parsing dominates at 67% of the
1324         total application cost. In this case, the single-threaded icXML should achieve a 1.5x
1325         speedup over Xerces so that the total application cost reduces to 67% of the original.
1326         However, in icXML-p, our ideal scenario gives us two well-balanced threads each performing
1327         about 33% of the original work. In this case, Amdahl's law predicts that we could expect up
1328         to a 3x speedup at best. </p>
1329<p id="idp594224"> At the other extreme of our design range, we consider an application in which core
1330         parsing cost is 40%. Assuming the 2x speedup of the Parabix Subsystem over the
1331         corresponding Xerces core, single-threaded icXML delivers a 25% speedup. However, the most
1332         significant aspect of our two-stage multi-threaded design then becomes the ability to hide
1333         the entire latency of parsing within the serial time required by the application. In this
1334         case, we achieve an overall speedup in processing time by 1.67x. </p>
1335<p id="idp595168"> Although the structure of the Parabix Subsystem allows division of the work into
1336         several pipeline stages and has been demonstrated to be effective for four pipeline stages
1337         in a research prototype \cite{HPCA2012}, our analysis here suggests that the further
1338         pipelining of work within the Parabix Subsystem is not worthwhile if the cost of
1339         application logic is little as 33% of the end-to-end cost using Xerces. To achieve benefits
1340         of further parallelization with multi-core technology, there would need to be reductions in
1341         the cost of application logic that could match reductions in core parsing cost. </p>
1343<div class="section" id="performance">
1344<h2 class="title" style="clear: both">Performance</h2>
1345<p id="idp598112"> We evaluate Xerces-C++ 3.1.1, icXML, icXML-p against two benchmarking applications: the
1346         Xerces C++ SAXCount sample application, and a real world GML to SVG transformation
1347         application. We investigated XML parser performance using an Intel Core i7 quad-core (Sandy
1348         Bridge) processor (3.40GHz, 4 physical cores, 8 threads (2 per core), 32+32 kB (per core)
1349         L1 cache, 256 kB (per core) L2 cache, 8 MB L3 cache) running the 64-bit version of Ubuntu
1350         12.04 (Linux). </p>
1351<p id="idp599024"> We analyzed the execution profiles of each XML parser using the performance counters
1352         found in the processor. We chose several key hardware events that provide insight into the
1353         profile of each application and indicate if the processor is doing useful work. The set of
1354         events included in our study are: processor cycles, branch instructions, branch
1355         mispredictions, and cache misses. The Performance Application Programming Interface (PAPI)
1356         Version 5.5.0 \cite{papi} toolkit was installed on the test system to facilitate the
1357         collection of hardware performance monitoring statistics. In addition, we used the Linux
1358         perf \cite{perf} utility to collect per core hardware events. </p>
1359<div class="section" id="idp600160">
1360<h3 class="title" style="clear: both">Xerces C++ SAXCount</h3>
1361<p id="idp600832"> Xerces comes with sample applications that demonstrate salient features of the
1362            parser. SAXCount is the simplest such application: it counts the elements, attributes
1363            and characters of a given XML file using the (event based) SAX API and prints out the
1364            totals. </p>
1365<p id="idp601536"> <a class="xref" href="#XMLdocs">Table VII</a> shows the document characteristics of the XML input files
1366            selected for the Xerces C++ SAXCount benchmark. The jaw.xml represents document-oriented
1367            XML inputs and contains the three-byte and four-byte UTF-8 sequence required for the
1368            UTF-8 encoding of Japanese characters. The remaining data files are data-oriented XML
1369            documents and consist entirely of single byte encoded ASCII characters.
1370  <div class="table-wrapper" id="XMLdocs">
1371<p class="title">Table VII</p>
1372<div class="caption"><p id="idp603872">XML Document Characteristics</p></div>
1373<table class="table" xml:id="XMLdocs">
1374<colgroup span="1">
1375<col align="left" valign="top" span="1">
1376<col align="centre" valign="top" span="1">
1377<col align="centre" valign="top" span="1">
1378<col align="centre" valign="top" span="1">
1379<col align="centre" valign="top" span="1">
1383<td>File Name           </td>
1384<td> jaw.xml            </td>
1385<td> road.gml   </td>
1386<td> po.xml     </td>
1387<td> soap.xml </td>
1390<td>File Type           </td>
1391<td> document           </td>
1392<td> data               </td>
1393<td> data               </td>
1394<td> data        </td>
1397<td>File Size (kB)              </td>
1398<td> 7343                       </td>
1399<td> 11584      </td>
1400<td> 76450              </td>
1401<td> 2717 </td>
1404<td>Markup Item Count   </td>
1405<td> 74882              </td>
1406<td> 280724     </td>
1407<td> 4634110    </td>
1408<td> 18004 </td>
1411<td>Markup Density              </td>
1412<td> 0.13                       </td>
1413<td> 0.57       </td>
1414<td> 0.76               </td>
1415<td> 0.87       </td>
1421<p id="idp619472"> A key predictor of the overall parsing performance of an XML file is markup
1422            density\footnote{ Markup Density: the ratio of markup bytes used to define the structure
1423            of the document vs. its file size.}. This metric has substantial influence on the
1424            performance of traditional recursive descent XML parsers because it directly corresponds
1425            to the number of state transitions that occur when parsing a document. We use a mixture
1426            of document-oriented and data-oriented XML files to analyze performance over a spectrum
1427            of markup densities. </p>
1428<p id="idp621088"> <a class="xref" href="#perf_SAX" title="SAXCount Performance Comparison">Figure 6</a> compares the performance of Xerces, icXML and pipelined icXML
1429            in terms of CPU cycles per byte for the SAXCount application. The speedup for icXML over
1430            Xerces is 1.3x to 1.8x. With two threads on the multicore machine, icXML-p can achieve
1431            speedup up to 2.7x. Xerces is substantially slowed by dense markup but icXML is less
1432            affected through a reduction in branches and the use of parallel-processing techniques.
1433            icXML-p performs better as markup-density increases because the work performed by each
1434            stage is well balanced in this application. </p>
1435<p id="idp622832">
1436        <div class="figure" id="perf_SAX">
1437<p class="title">Figure 6: SAXCount Performance Comparison</p>
1438<div class="figure-contents">
1439<div class="mediaobject" id="idp624144"><img alt="png image (perf_SAX.png)" src="perf_SAX.png" width="500cm"></div>
1440<div class="caption"></div>
1443         </p>
1445<div class="section" id="idp626688">
1446<h3 class="title" style="clear: both">GML2SVG</h3>
1447<p id="idp627360">       As a more substantial application of XML processing, the GML-to-SVG (GML2SVG) application
1448was chosen.   This application transforms geospatially encoded data represented using
1449an XML representation in the form of Geography Markup Language (GML) \cite{lake2004geography}
1450into a different XML format  suitable for displayable maps:
1451Scalable Vector Graphics (SVG) format\cite{lu2007advances}. In the GML2SVG benchmark, GML feature elements
1452and GML geometry elements tags are matched. GML coordinate data are then extracted
1453and transformed to the corresponding SVG path data encodings.
1454Equivalent SVG path elements are generated and output to the destination
1455SVG document.  The GML2SVG application is thus considered typical of a broad
1456class of XML applications that parse and extract information from
1457a known XML format for the purpose of analysis and restructuring to meet
1458the requirements of an alternative format.</p>
1459<p id="idp628688">Our GML to SVG data translations are executed on GML source data
1460modelling the city of Vancouver, British Columbia, Canada.
1461The GML source document set
1462consists of 46 distinct GML feature layers ranging in size from approximately 9 KB to 125.2 MB
1463and with an average document size of 18.6 MB. Markup density ranges from approximately 0.045 to 0.719
1464and with an average markup density of 0.519. In this performance study,
1465213.4 MB of source GML data generates 91.9 MB of target SVG data.</p>
1466<div class="figure" id="perf_GML2SVG">
1467<p class="title">Figure 7: Performance Comparison for GML2SVG</p>
1468<div class="figure-contents">
1469<div class="mediaobject" id="idp630672"><img alt="png image (Throughput.png)" src="Throughput.png" width="500cm"></div>
1470<div class="caption"></div>
1473<p id="idp632960"><a class="xref" href="#perf_GML2SVG" title="Performance Comparison for GML2SVG">Figure 7</a> compares the performance of the GML2SVG application linked against
1474the Xerces, icXML and icXML-p.   
1475On the GML workload with this application, single-thread icXML
1476achieved about a 50% acceleration over Xerces,
1477increasing throughput on our test machine from 58.3 MB/sec to 87.9 MB/sec.   
1478Using icXML-p, a further throughput increase to 111 MB/sec was recorded,
1479approximately a 2X speedup.</p>
1480<p id="idp634368">An important aspect of icXML is the replacement of much branch-laden
1481sequential code inside Xerces with straight-line SIMD code using far
1482fewer branches.  <a class="xref" href="#branchmiss_GML2SVG" title="Comparative Branch Misprediction Rate">Figure 8</a> shows the corresponding
1483improvement in branching behaviour, with a dramatic reduction in branch misses per kB.
1484It is also interesting to note that icXML-p goes even further.   
1485In essence, in using pipeline parallelism to split the instruction
1486stream onto separate cores, the branch target buffers on each core are
1487less overloaded and able to increase the successful branch prediction rate.</p>
1488<div class="figure" id="branchmiss_GML2SVG">
1489<p class="title">Figure 8: Comparative Branch Misprediction Rate</p>
1490<div class="figure-contents">
1491<div class="mediaobject" id="idp637104"><img alt="png image (BM.png)" src="BM.png" width="500cm"></div>
1492<div class="caption"></div>
1495<p id="idp639392">The behaviour of the three versions with respect to L1 cache misses per kB is shown
1496in <a class="xref" href="#cachemiss_GML2SVG" title="Comparative Cache Miss Rate">Figure 9</a>.   Improvements are shown in both instruction-
1497and data-cache performance with the improvements in instruction-cache
1498behaviour the most dramatic.   Single-threaded icXML shows substantially improved
1499performance over Xerces on both measures.   
1500Although icXML-p is slightly worse with respect to data-cache performance,
1501this is more than offset by a further dramatic reduction in instruction-cache miss rate.
1502Again partitioning the instruction stream through the pipeline parallelism model has
1503significant benefit.</p>
1504<div class="figure" id="cachemiss_GML2SVG">
1505<p class="title">Figure 9: Comparative Cache Miss Rate</p>
1506<div class="figure-contents">
1507<div class="mediaobject" id="idp642192"><img alt="png image (CM.png)" src="CM.png" width="500cm"></div>
1508<div class="caption"></div>
1511<p id="idp644480">One caveat with this study is that the GML2SVG application did not exhibit
1512a relative balance of processing between application code and Xerces library
1513code reaching the 33% figure.  This suggests that for this application and
1514possibly others, further separating the logical layers of the
1515icXML engine into different pipeline stages could well offer significant benefit.
1516This remains an area of ongoing work.</p>
1519<div class="section" id="conclusion">
1520<h2 class="title" style="clear: both">Conclusion and Future Work</h2>
1521<p id="idp646640"> This paper is the first case study documenting the significant performance benefits
1522         that may be realized through the integration of parallel bitstream technology into existing
1523         widely-used software libraries. In the case of the Xerces-C++ XML parser, the combined
1524         integration of SIMD and multicore parallelism was shown capable of dramatic producing
1525         dramatic increases in throughput and reductions in branch mispredictions and cache misses.
1526         The modified parser, going under the name icXML is designed to provide the full
1527         functionality of the original Xerces library with complete compatibility of APIs. Although
1528         substantial re-engineering was required to realize the performance potential of parallel
1529         technologies, this is an important case study demonstrating the general feasibility of
1530         these techniques. </p>
1531<p id="idp647920"> The further development of icXML to move beyond 2-stage pipeline parallelism is
1532         ongoing, with realistic prospects for four reasonably balanced stages within the library.
1533         For applications such as GML2SVG which are dominated by time spent on XML parsing, such a
1534         multistage pipelined parsing library should offer substantial benefits. </p>
1535<p id="idp648688"> The example of XML parsing may be considered prototypical of finite-state machines
1536         applications which have sometimes been considered "embarassingly
1537         sequential" and so difficult to parallelize that "nothing
1538         works." So the case study presented here should be considered an important data
1539         point in making the case that parallelization can indeed be helpful across a broad array of
1540         application types. </p>
1541<p id="idp650064"> To overcome the software engineering challenges in applying parallel bitstream
1542         technology to existing software systems, it is clear that better library and tool support
1543         is needed. The techniques used in the implementation of icXML and documented in this paper
1544         could well be generalized for applications in other contexts and automated through the
1545         creation of compiler technology specifically supporting parallel bitstream programming.
1546      </p>
1548<div class="bibliography" id="idp652000">
1549<h2 class="title" style="clear:both">Bibliography</h2>
1550<p class="bibliomixed" id="XMLChip09">[Leventhal and Lemoine 2009] Leventhal, Michael and
1551         Eric Lemoine 2009. The XML chip at 6 years. Proceedings of International Symposium on
1552         Processing XML Efficiently 2009, Montréal.</p>
1553<p class="bibliomixed" id="Datapower09">[Salz, Achilles and Maze 2009] Salz, Richard,
1554         Heather Achilles, and David Maze. 2009. Hardware and software trade-offs in the IBM
1555         DataPower XML XG4 processor card. Proceedings of International Symposium on Processing XML
1556         Efficiently 2009, Montréal.</p>
1557<p class="bibliomixed" id="PPoPP08">[Cameron 2007] Cameron, Robert D. 2007. A Case Study
1558         in SIMD Text Processing with Parallel Bit Streams UTF-8 to UTF-16 Transcoding. Proceedings
1559         of 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2008, Salt
1560         Lake City, Utah. On the Web at <a href="" class="link" target="_new"></a>.</p>
1561<p class="bibliomixed" id="CASCON08">[Cameron, Herdy and Lin 2008] Cameron, Robert D.,
1562         Kenneth S Herdy, and Dan Lin. 2008. High Performance XML Parsing Using Parallel Bit Stream
1563         Technology. Proceedings of CASCON 2008. 13th ACM SIGPLAN Symposium on Principles and
1564         Practice of Parallel Programming 2008, Toronto.</p>
1565<p class="bibliomixed" id="SVGOpen08">[Herdy, Burggraf and Cameron 2008] Herdy, Kenneth
1566         S., Robert D. Cameron and David S. Burggraf. 2008. High Performance GML to SVG
1567         Transformation for the Visual Presentation of Geographic Data in Web-Based Mapping Systems.
1568         Proceedings of SVG Open 6th International Conference on Scalable Vector Graphics,
1569         Nuremburg. On the Web at
1570            <a href="" class="link" target="_new"></a>.</p>
1571<p class="bibliomixed" id="Ross06">[Ross 2006] Ross, Kenneth A. 2006. Efficient hash
1572         probes on modern processors. Proceedings of ICDE, 2006. ICDE 2006, Atlanta. On the Web at
1573            <a href="" class="link" target="_new"></a>.</p>
1574<p class="bibliomixed" id="ASPLOS09">[Cameron and Lin 2009] Cameron, Robert D. and Dan
1575         Lin. 2009. Architectural Support for SWAR Text Processing with Parallel Bit Streams: The
1576         Inductive Doubling Principle. Proceedings of ASPLOS 2009, Washington, DC.</p>
1577<p class="bibliomixed" id="Wu08">[Wu et al. 2008] Wu, Yu, Qi Zhang, Zhiqiang Yu and
1578         Jianhui Li. 2008. A Hybrid Parallel Processing for XML Parsing and Schema Validation.
1579         Proceedings of Balisage 2008, Montréal. On the Web at
1580            <a href="" class="link" target="_new"></a>.</p>
1581<p class="bibliomixed" id="u8u16">[Cameron 2008] u8u16 - A High-Speed UTF-8 to UTF-16
1582         Transcoder Using Parallel Bit Streams Technical Report 2007-18. 2007. School of Computing
1583         Science Simon Fraser University, June 21 2007.</p>
1584<p class="bibliomixed" id="XML10">[XML 1.0] Extensible Markup Language (XML) 1.0 (Fifth
1585         Edition) W3C Recommendation 26 November 2008. On the Web at
1586            <a href="" class="link" target="_new"></a>.</p>
1587<p class="bibliomixed" id="Unicode">[Unicode] The Unicode Consortium. 2009. On the Web at
1588            <a href="" class="link" target="_new"></a>.</p>
1589<p class="bibliomixed" id="Pex06">[Hilewitz and Lee 2006]  Hilewitz, Y. and Ruby B. Lee.
1590         2006. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit
1591         Instructions. Proceedings of the IEEE 17th International Conference on Application-Specific
1592         Systems, Architectures and Processors (ASAP), pp. 65-72, September 11-13, 2006.</p>
1593<p class="bibliomixed" id="InfoSet">[XML Infoset] XML Information Set (Second Edition) W3C
1594         Recommendation 4 February 2004. On the Web at
1595         <a href="" class="link" target="_new"></a>.</p>
1596<p class="bibliomixed" id="Saxon">[Saxon] SAXON The XSLT and XQuery Processor. On the Web
1597         at <a href="" class="link" target="_new"></a>.</p>
1598<p class="bibliomixed" id="Kay08">[Kay 2008]  Kay, Michael Y. 2008. Ten Reasons Why Saxon
1599         XQuery is Fast, IEEE Data Engineering Bulletin, December 2008.</p>
1600<p class="bibliomixed" id="AElfred">[Ælfred]  The Ælfred XML Parser. On the Web at
1601            <a href="" class="link" target="_new"></a>.</p>
1602<p class="bibliomixed" id="JNI">[Hitchens 2002] Hitchens, Ron. Java NIO. O'Reilly, 2002.</p>
1603<p class="bibliomixed" id="Expat">[Expat] The Expat XML Parser.
1604            <a href="" class="link" target="_new"></a>.</p>
1607<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em">
1608<i>Balisage:</i> <small>The Markup Conference</small>
Note: See TracBrowser for help on using the repository browser.