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

Last change on this file since 3055 was 3055, checked in by cameron, 6 years ago


File size: 93.2 KB
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
2<html lang="en">
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6<link rel="stylesheet" href="balisage-proceedings.css" type="text/css">
7<meta name="keywords" content="">
10<div id="balisage-header"><h1 style="text-align: right; font-family: serif; margin:0.25em">
11<i>Balisage:</i> <small>The Markup Conference</small>
13<html lang="en">
16<link rel="stylesheet" href="balisage-proceedings.css" type="text/css">
17<meta name="generator" content="Balisage Conference Proceedings XSLT (v1.2)">
18<script type="text/javascript">
19    function toggle(folderID) {
20      folder = document.getElementById("folder-"+folderID);
21      icon = document.getElementById("icon-"+folderID)
22      // need to:
23      //   switch between 'none' and 'block'
24      //   switch between collapse and expand icons
25      if ( != "block") {
26 = "block";
27        icon.src = "minus.png" ;
28        icon.alt = "collapse" ;
29      }
30      else {
31 = "none";
32        icon.src = "plus.png" ;
33        icon.alt = "expand" ;
34      };
35      return;
36    }
38   function hidecite(citeID) {
39     cite = document.getElementById(citeID);
40 = "none";
41     return;
42   }
44   function showcite(citeID,anchorID) {
45     cite = document.getElementById(citeID);
47     citeLeft =;
48     citeTop =;
50     if (citeLeft != (getLeft(anchorID)+"px") ||
51         citeTop != (getTop(anchorID)+"px")) {
52 = "none";
53     }
55     if ( != "table-cell") {
56        movebox(citeID, anchorID);
57 = "table-cell";
58     }
59     else {
60 = "none";
61     };
62     return;
63   }
65   function movebox(citeID, anchorID) {
67     cite = document.getElementById(citeID);
69     // alert(cite.offsetWidth + " by " + cite.offsetHeight)
71     horizontalOffset = getLeft(anchorID);
72     // horizontalOffset = (inMain(anchorID)) ?
73     // (horizontalOffset - 260) : (horizontalOffset + 20)
74     // (horizontalOffset - (20 + cite.offsetWidth)) : (horizontalOffset + 20)
76     verticalOffset = getTop(anchorID);
77     // verticalOffset = (inMain(anchorID)) ?
78     // (verticalOffset - 20) : (verticalOffset + 20)
79     // (verticalOffset - (20 + cite.offsetHeight)) : (verticalOffset + 20)
81     /*
82     horizontalOffset = getAbsoluteLeft(anchorID) - getScrollLeft(anchorID) + 20;
83     if (inMain(anchorID)) {
84       horizontalOffset = horizontalOffset - 300;
85     }
86     verticalOffset = getAbsoluteTop(anchorID) - getScrollTop(anchorID) - 40;
87     if (inMain(anchorID)) {
88       verticalOffset = verticalOffset - 300;
89     }
90     */
92 = horizontalOffset + "px";
93 = verticalOffset + "px";
94   }
96   function getLeft(objectID) {
97     var left = getAbsoluteLeft(objectID) - getScrollLeft(objectID);
98     left = (inMain(objectID)) ? (left - 260) : (left + 20)   
99     return left;
100   }
102   function getTop(objectID) {
103     var top = getAbsoluteTop(objectID) - getScrollTop(objectID);
104     top = (inMain(objectID)) ? (top - 50) : (top + 20)
105     return top;     
106   }
108   function getAbsoluteLeft(objectId) {
109   // Get an object left position from the upper left viewport corner
110     o = document.getElementById(objectId)
111     oLeft = o.offsetLeft            // Get left position from the parent object
112     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
113       oParent = o.offsetParent    // Get parent object reference
114       oLeft += oParent.offsetLeft // Add parent left position
115       o = oParent
116      }
117    return oLeft
118    }
120    function getAbsoluteTop(objectId) {
121    // Get an object top position from the upper left viewport corner
122      o = document.getElementById(objectId)
123      oTop = o.offsetTop            // Get top position from the parent object
124      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
125        oParent = o.offsetParent  // Get parent object reference
126        oTop += oParent.offsetTop // Add parent top position
127        o = oParent
128      }
129    return oTop
130    }
132   function getScrollLeft(objectId) {
133     // Get a left scroll position
134     o = document.getElementById(objectId)
135     oLeft = o.scrollLeft            // Get left position from the parent object
136     while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
137       oParent = o.offsetParent    // Get parent object reference
138       oLeft += oParent.scrollLeft // Add parent left position
139       o = oParent
140      }
141    return oLeft
142    }
144    function getScrollTop(objectId) {
145    // Get a right scroll position
146      o = document.getElementById(objectId)
147      oTop = o.scrollTop            // Get top position from the parent object
148      while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
149        oParent = o.offsetParent  // Get parent object reference
150        oTop += oParent.scrollTop // Add parent top position
151        o = oParent
152      }
153    return oTop
154    }
156    function inMain(objectId) {
157    // returns true if in div#main
158      o = document.getElementById(objectId)
159      while(o.parentNode != null) { // Parse the parent hierarchy up to div#main
160        oParent = o.parentNode
161        if ( == "main") { return true; }
162        o = oParent;
163      }
164    return false;
165    }
168   /*
169   function showcite(citeID) {
170      cite = document.getElementById(citeID);
171      if ( != "table-cell") {
172 = "table-cell";
173      }
174      else {
175 = "none";
176      };
177      return;
178    }
179    */
181      </script>
184<div class="inline-citation" id="cite-XMLChip09" style="display:none;width: 240px">
185<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
186         Eric Lemoine 2009. The XML chip at 6 years. Proceedings of International Symposium on
187         Processing XML Efficiently 2009, Montréal.</p>
189<div class="inline-citation" id="cite-Datapower09" style="display:none;width: 240px">
190<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,
191         Heather Achilles, and David Maze. 2009. Hardware and software trade-offs in the IBM
192         DataPower XML XG4 processor card. Proceedings of International Symposium on Processing XML
193         Efficiently 2009, Montréal.</p>
195<div class="inline-citation" id="cite-PPoPP08" style="display:none;width: 240px">
196<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
197         in SIMD Text Processing with Parallel Bit Streams UTF-8 to UTF-16 Transcoding. Proceedings
198         of 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2008, Salt
199         Lake City, Utah. On the Web at <a href="" class="link" target="_new"></a>.</p>
201<div class="inline-citation" id="cite-CASCON08" style="display:none;width: 240px">
202<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.,
203         Kenneth S Herdy, and Dan Lin. 2008. High Performance XML Parsing Using Parallel Bit Stream
204         Technology. Proceedings of CASCON 2008. 13th ACM SIGPLAN Symposium on Principles and
205         Practice of Parallel Programming 2008, Toronto.</p>
207<div class="inline-citation" id="cite-SVGOpen08" style="display:none;width: 240px">
208<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
209         S., Robert D. Cameron and David S. Burggraf. 2008. High Performance GML to SVG
210         Transformation for the Visual Presentation of Geographic Data in Web-Based Mapping Systems.
211         Proceedings of SVG Open 6th International Conference on Scalable Vector Graphics,
212         Nuremburg. On the Web at
213            <a href="" class="link" target="_new"></a>.</p>
215<div class="inline-citation" id="cite-Ross06" style="display:none;width: 240px">
216<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
217         probes on modern processors. Proceedings of ICDE, 2006. ICDE 2006, Atlanta. On the Web at
218            <a href="" class="link" target="_new"></a>.</p>
220<div class="inline-citation" id="cite-ASPLOS09" style="display:none;width: 240px">
221<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
222         Lin. 2009. Architectural Support for SWAR Text Processing with Parallel Bit Streams: The
223         Inductive Doubling Principle. Proceedings of ASPLOS 2009, Washington, DC.</p>
225<div class="inline-citation" id="cite-Wu08" style="display:none;width: 240px">
226<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
227         Jianhui Li. 2008. A Hybrid Parallel Processing for XML Parsing and Schema Validation.
228         Proceedings of Balisage 2008, Montréal. On the Web at
229            <a href="" class="link" target="_new"></a>.</p>
231<div class="inline-citation" id="cite-u8u16" style="display:none;width: 240px">
232<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
233         Transcoder Using Parallel Bit Streams Technical Report 2007-18. 2007. School of Computing
234         Science Simon Fraser University, June 21 2007.</p>
236<div class="inline-citation" id="cite-XML10" style="display:none;width: 240px">
237<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
238         Edition) W3C Recommendation 26 November 2008. On the Web at
239            <a href="" class="link" target="_new"></a>.</p>
241<div class="inline-citation" id="cite-Unicode" style="display:none;width: 240px">
242<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
243            <a href="" class="link" target="_new"></a>.</p>
245<div class="inline-citation" id="cite-Pex06" style="display:none;width: 240px">
246<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.
247         2006. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit
248         Instructions. Proceedings of the IEEE 17th International Conference on Application-Specific
249         Systems, Architectures and Processors (ASAP), pp. 65-72, September 11-13, 2006.</p>
251<div class="inline-citation" id="cite-InfoSet" style="display:none;width: 240px">
252<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
253         Recommendation 4 February 2004. On the Web at
254         <a href="" class="link" target="_new"></a>.</p>
256<div class="inline-citation" id="cite-Saxon" style="display:none;width: 240px">
257<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
258         at <a href="" class="link" target="_new"></a>.</p>
260<div class="inline-citation" id="cite-Kay08" style="display:none;width: 240px">
261<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
262         XQuery is Fast, IEEE Data Engineering Bulletin, December 2008.</p>
264<div class="inline-citation" id="cite-AElfred" style="display:none;width: 240px">
265<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
266            <a href="" class="link" target="_new"></a>.</p>
268<div class="inline-citation" id="cite-JNI" style="display:none;width: 240px">
269<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>
271<div class="inline-citation" id="cite-Expat" style="display:none;width: 240px">
272<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.
273            <a href="" class="link" target="_new"></a>.</p>
275<div id="mast"><div class="content">
276<h2 class="article-title" id="idp66368"></h2>
277<div class="author">
278<h3 class="author">Nigel Medforth</h3>
279<div class="affiliation">
280<p class="jobtitle">Developer</p>
281<p class="orgname">International Characters Inc.</p>
283<div class="affiliation">
284<p class="jobtitle">Graduate Student, School of Computing Science</p>
285<p class="orgname">Simon Fraser University </p>
287<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
289<div class="author">
290<h3 class="author">Dan Lin</h3>
291<div class="affiliation">
292<p class="jobtitle">Graduate Student, School of Computing Science</p>
293<p class="orgname">Simon Fraser University </p>
295<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
297<div class="author">
298<h3 class="author">Kenneth Herdy</h3>
299<div class="affiliation">
300<p class="jobtitle">Graduate Student, School of Computing Science</p>
301<p class="orgname">Simon Fraser University </p>
303<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
305<div class="author">
306<h3 class="author">Rob Cameron</h3>
307<div class="affiliation">
308<p class="jobtitle">Professor of Computing Science</p>
309<p class="orgname">Simon Fraser University</p>
311<div class="affiliation">
312<p class="jobtitle">Chief Technology Officer</p>
313<p class="orgname">International Characters, Inc.</p>
315<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
317<div class="author">
318<h3 class="author">Arrvindh Shriraman</h3>
319<div class="affiliation">
320<p class="jobtitle"></p>
321<p class="orgname"></p>
323<h5 class="author-email"><code class="email">&lt;<a class="email" href="mailto:"></a>&gt;</code></h5>
325<div class="mast-box">
326<p class="title"><a href="javascript:toggle('idp67488')" class="quiet"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp67488"></a> <span onclick="javascript:toggle('idp67488');return true">Abstract</span></p>
327<div class="folder" id="folder-idp67488" style="display:none"><p id="idp67792">Prior research on the acceleration of XML processing using SIMD and multi-core
328            parallelism has lead to a number of interesting research prototypes. This work
329            investigates the extent to which the techniques underlying these prototypes could result
330            in systematic performance benefits when fully integrated into a commercial XML parser.
331            The widely used Xerces-C++ parser of the Apache Software Foundation was chosen as the
332            foundation for the study. A systematic restructuring of the parser was undertaken, while
333            maintaining the existing API for application programmers. Using SIMD techniques alone,
334            an increase in parsing speed of at least 50% was observed in a range of applications.
335            When coupled with pipeline parallelism on dual core processors, improvements of 2x and
336            beyond were realized. </p></div>
338<div class="toc">
339<p><b>Table of Contents</b></p>
341<dt><span class="section"><a href="#idp276064" class="toc">Introduction</a></span></dt>
342<dt><span class="section"><a href="#idp277856" class="toc">Background</a></span></dt>
344<dt><span class="section"><a href="#idp278496" class="toc">Xerces C++ Structure</a></span></dt>
345<dt><span class="section"><a href="#idp333696" class="toc">The Parabix Framework</a></span></dt>
346<dt><span class="section"><a href="#idp426176" class="toc">Sequential vs. Parallel Paradigm</a></span></dt>
348<dt><span class="section"><a href="#idp430592" class="toc">Architecture</a></span></dt>
350<dt><span class="section"><a href="#idp431264" class="toc">Overview</a></span></dt>
351<dt><span class="section"><a href="#idp460576" class="toc">Character Set Adapters</a></span></dt>
352<dt><span class="section"><a href="#idp468560" class="toc">Combined Parallel Filtering</a></span></dt>
353<dt><span class="section"><a href="#idp485632" class="toc">Content Stream</a></span></dt>
354<dt><span class="section"><a href="#idp496352" class="toc">Namespace Handling</a></span></dt>
355<dt><span class="section"><a href="#idp539680" class="toc">Error Handling</a></span></dt>
357<dt><span class="section"><a href="#idp549968" class="toc">Multithreading with Pipeline Parallelism</a></span></dt>
358<dt><span class="section"><a href="#idp572016" class="toc">Performance</a></span></dt>
360<dt><span class="section"><a href="#idp574736" class="toc">Xerces C++ SAXCount</a></span></dt>
361<dt><span class="section"><a href="#idp598880" class="toc">GML2SVG</a></span></dt>
363<dt><span class="section"><a href="#idp624032" class="toc">Conclusion and Future Work</a></span></dt>
366<div class="mast-box">
367<p class="title"><a href="javascript:toggle('idp69216')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp69216"></a> <span onclick="javascript:toggle('idp69216');return true">Nigel Medforth</span></p>
368<div class="folder" id="folder-idp69216" style="display:none">
369<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
370<div class="affiliation">
371<p class="jobtitle">Developer</p>
372<p class="orgname">International Characters Inc.</p>
374<div class="affiliation">
375<p class="jobtitle">Graduate Student, School of Computing Science</p>
376<p class="orgname">Simon Fraser University </p>
378<div class="personblurb">
379<p id="idp50976">Nigel Medforth is a M.Sc. student at Simon Fraser University and the lead
380               developer of icXML. He earned a Bachelor of Technology in Information Technology at
381               Kwantlen Polytechnic University in 2009 and was awarded the Dean’s Medal for
382               Outstanding Achievement.</p>
383<p id="idp51984">Nigel is currently researching ways to leverage both the Parabix framework and
384               stream-processing models to further accelerate XML parsing within icXML.</p>
388<div class="mast-box">
389<p class="title"><a href="javascript:toggle('idp55648')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp55648"></a> <span onclick="javascript:toggle('idp55648');return true">Dan Lin</span></p>
390<div class="folder" id="folder-idp55648" style="display:none">
391<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
392<div class="affiliation">
393<p class="jobtitle">Graduate Student, School of Computing Science</p>
394<p class="orgname">Simon Fraser University </p>
396<div class="personblurb"><p id="idp57360">Dan Lin is a Ph.D student at Simon Fraser University. She earned a Master of Science
397             in Computing Science at Simon Fraser University in 2010. Her research focus on on high
398             performance algorithms that exploit parallelization strategies on various multicore platforms.
399           </p></div>
402<div class="mast-box">
403<p class="title"><a href="javascript:toggle('idp59920')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp59920"></a> <span onclick="javascript:toggle('idp59920');return true">Kenneth Herdy</span></p>
404<div class="folder" id="folder-idp59920" style="display:none">
405<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
406<div class="affiliation">
407<p class="jobtitle">Graduate Student, School of Computing Science</p>
408<p class="orgname">Simon Fraser University </p>
410<div class="personblurb">
411<p id="idp61648"> Ken Herdy completed an Advanced Diploma of Technology in Geographical Information
412               Systems at the British Columbia Institute of Technology in 2003 and earned a Bachelor
413               of Science in Computing Science with a Certificate in Spatial Information Systems at
414               Simon Fraser University in 2005. </p>
415<p id="idp262928"> Ken is currently pursuing PhD studies in Computing Science at Simon Fraser
416               University with industrial scholarship support from the Natural Sciences and
417               Engineering Research Council of Canada, the Mathematics of Information Technology and
418               Complex Systems NCE, and the BC Innovation Council. His research focus is an analysis
419               of the principal techniques that may be used to improve XML processing performance in
420               the context of the Geography Markup Language (GML). </p>
424<div class="mast-box">
425<p class="title"><a href="javascript:toggle('idp265664')" class="linkbox"><img class="toc-icon" src="plus.png" alt="expand" id="icon-idp265664"></a> <span onclick="javascript:toggle('idp265664');return true">Rob Cameron</span></p>
426<div class="folder" id="folder-idp265664" style="display:none">
427<h5 class="author-email"><code class="email">&lt;<a class="email" href=""></a>&gt;</code></h5>
428<div class="affiliation">
429<p class="jobtitle">Professor of Computing Science</p>
430<p class="orgname">Simon Fraser University</p>
432<div class="affiliation">
433<p class="jobtitle">Chief Technology Officer</p>
434<p class="orgname">International Characters, Inc.</p>
436<div class="personblurb"><p id="idp267328">Dr. Rob Cameron is Professor of Computing Science and Associate Dean of Applied
437               Sciences at Simon Fraser University. His research interests include programming
438               language and software system technology, with a specific focus on high performance
439               text processing using SIMD and multicore parallelism. He is the developer of the REX
440               XML shallow parser as well as the parallel bit stream (Parabix) framework for SIMD
441               text processing. </p></div>
445<div id="navbar"></div>
446<div id="balisage-header" style="background-color: #6699CC">
447<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>
448<h1 class="page-header">Proceedings preview</h1>
450<div id="main">
451<div class="article">
452<h2 class="article-title" id="idp66368"></h2>
453<div class="section" id="idp276064">
454<h2 class="title" style="clear: both">Introduction</h2>
455<p id="idp276704"></p>
456<p id="idp276960"></p>
457<p id="idp277216"></p>
458<p id="idp277472"></p>
460<div class="section" id="idp277856">
461<h2 class="title" style="clear: both">Background</h2>
462<div class="section" id="idp278496">
463<h3 class="title" style="clear: both">Xerces C++ Structure</h3>
464<p id="idp279136"> The Xerces C++ parser is a widely-used standards-conformant
465            XML parser produced as open-source software
466             by the Apache Software Foundation.
467            It features comprehensive support for a variety of character encodings both
468            commonplace (e.g., UTF-8, UTF-16) and rarely used (e.g., EBCDIC), support for multiple
469            XML vocabularies through the XML namespace mechanism, as well as complete
470            implementations of structure and data validation through multiple grammars declared
471            using either legacy DTDs (document type definitions) or modern XML Schema facilities.
472            Xerces also supports several APIs for accessing parser services, including event-based
473            parsing using either pull parsing or SAX/SAX2 push-style parsing as well as a DOM
474            tree-based parsing interface. </p>
475<p id="idp280400">
476            Xerces,
477            like all traditional parsers, processes XML documents sequentially a byte-at-a-time from
478            the first to the last byte of input data. Each byte passes through several processing
479            layers and is classified and eventually validated within the context of the document
480            state. This introduces implicit dependencies between the various tasks within the
481            application that make it difficult to optimize for performance. As a complex software
482              system, no one feature dominates the overall parsing performance. <a class="xref" href="#xerces-profile">Table I</a>
483            shows the execution time profile of the top ten functions in a
484            typical run. Even if it were possible, Amdahl's Law dictates that tackling any one of
485            these functions for parallelization in isolation would only produce a minute improvement
486            in performance. Unfortunately, early investigation into these functions found that
487            incorporating speculation-free thread-level parallelization was impossible and they were
488            already performing well in their given tasks; thus only trivial enhancements were
489            attainable. In order to obtain a systematic acceleration of Xerces, it should be
490            expected that a comprehensive restructuring is required, involving all aspects of the
491            parser. </p>
492<div class="table-wrapper" id="xerces-profile">
493<p class="title">Table I</p>
494<div class="caption"><p id="idm855808">Execution Time of Top 10 Xerces Functions</p></div>
495<table class="table" xml:id="xerces-profile">
496<colgroup span="1">
497<col align="left" valign="top" span="1">
498<col align="left" valign="top" span="1">
501<th>Time (%) </th>
502<th> Function Name </th>
505<tr valign="top">
506<td>13.29       </td>
507<td>XMLUTF8Transcoder::transcodeFrom </td>
509<tr valign="top">
510<td>7.45        </td>
511<td>IGXMLScanner::scanCharData </td>
513<tr valign="top">
514<td>6.83        </td>
515<td>memcpy </td>
517<tr valign="top">
518<td>5.83        </td>
519<td>XMLReader::getNCName </td>
521<tr valign="top">
522<td>4.67        </td>
523<td>IGXMLScanner::buildAttList </td>
525<tr valign="top">
526<td>4.54        </td>
527<td>RefHashTableO&lt;&gt;::findBucketElem </td>
529<tr valign="top">
530<td>4.20        </td>
531<td>IGXMLScanner::scanStartTagNS </td>
533<tr valign="top">
534<td>3.75        </td>
535<td>ElemStack::mapPrefixToURI </td>
537<tr valign="top">
538<td>3.58        </td>
539<td>ReaderMgr::getNextChar </td>
541<tr valign="top">
542<td>3.20        </td>
543<td>IGXMLScanner::basicAttrValueScan </td>
549<div class="section" id="idp333696">
550<h3 class="title" style="clear: both">The Parabix Framework</h3>
551<p id="idp334368"> The Parabix (parallel bit stream) framework is a transformative approach to XML
552            parsing (and other forms of text processing.) The key idea is to exploit the
553            availability of wide SIMD registers (e.g., 128-bit) in commodity processors to represent
554            data from long blocks of input data by using one register bit per single input byte. To
555            facilitate this, the input data is first transposed into a set of basis bit streams.
556              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
557                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>.
560            Boolean-logic operations\footnote{∧, \√ and ¬ denote the
561            boolean AND, OR and NOT operators.} are used to classify the input bits into a set of
562               <span class="ital">character-class bit streams</span>, which identify key
563            characters (or groups of characters) with a <code class="code">1</code>. For example, one of the
564            fundamental characters in XML is a left-angle bracket. A character is an
565               <code class="code">'&lt;' if and only if
566               Â¬(b<sub>0</sub> âˆš b<sub>1</sub>)
567               âˆ§ (b<sub>2</sub> âˆ§ b<sub>3</sub>)
568               âˆ§ (b<sub>4</sub> âˆ§ b<sub>5</sub>)
569               âˆ§ ¬ (b<sub>6</sub> âˆš
570               b<sub>7</sub>) = 1</code>. Similarly, a character is numeric, <code class="code">[0-9]
571               if and only if ¬(b<sub>0</sub> âˆš
572               b<sub>1</sub>) ∧ (b<sub>2</sub> âˆ§
573                  b<sub>3</sub>) ∧ ¬(b<sub>4</sub>
574               âˆ§ (b<sub>5</sub> âˆš
575            b<sub>6</sub>))</code>. An important observation here is that ranges of
576            characters may require fewer operations than individual characters and
577             multiple
578            classes can share the classification cost. </p>
579<div class="table-wrapper" id="xml-bytes">
580<p class="title">Table II</p>
581<div class="caption"><p id="idp348928">XML Source Data</p></div>
582<table class="table" xml:id="xml-bytes">
583<colgroup span="1">
584<col align="right" valign="top" span="1">
585<col align="centre" valign="top" span="1">
586<col align="centre" valign="top" span="1">
587<col align="centre" valign="top" span="1">
588<col align="centre" valign="top" span="1">
592<td>String </td>
593<td> <code class="code">b</code> </td>
594<td> <code class="code">7</code> </td>
595<td> <code class="code">&lt;</code> </td>
596<td> <code class="code">A</code> </td>
599<td>ASCII </td>
600<td> <code class="code">0110001<span class="bold">0</span></code> </td>
601<td> <code class="code">0011011<span class="bold">1</span></code> </td>
602<td> <code class="code">0011110<span class="bold">0</span></code> </td>
603<td> <code class="code">0100000<span class="bold">1</span></code> </td>
608<div class="table-wrapper" id="xml-bits">
609<p class="title">Table III</p>
610<div class="caption"><p id="idp365200">8-bit ASCII Basis Bit Streams</p></div>
611<table class="table" xml:id="xml-bits">
612<colgroup span="1">
613<col align="centre" valign="top" span="1">
614<col align="centre" valign="top" span="1">
615<col align="centre" valign="top" span="1">
616<col align="centre" valign="top" span="1">
617<col align="centre" valign="top" span="1">
618<col align="centre" valign="top" span="1">
619<col align="centre" valign="top" span="1">
620<col align="centre" valign="top" span="1">
624<td> b<sub>0</sub> </td>
625<td> b<sub>1</sub> </td>
626<td> b<sub>2</sub> </td>
627<td> b<sub>3</sub>
629<td> b<sub>4</sub> </td>
630<td> b<sub>5</sub> </td>
631<td> b<sub>6</sub> </td>
632<td> b<sub>7</sub> </td>
635<td> <code class="code">0</code> </td>
636<td> <code class="code">1</code> </td>
637<td> <code class="code">1</code> </td>
638<td> <code class="code">0</code> </td>
639<td> <code class="code">0</code> </td>
640<td> <code class="code">0</code> </td>
641<td> <code class="code">1</code> </td>
642<td> <span class="bold"><code class="code">0</code></span> </td>
645<td> <code class="code">0</code> </td>
646<td> <code class="code">0</code> </td>
647<td> <code class="code">1</code> </td>
648<td> <code class="code">1</code> </td>
649<td> <code class="code">0</code> </td>
650<td> <code class="code">1</code> </td>
651<td> <code class="code">1</code> </td>
652<td> <span class="bold"><code class="code">1</code></span> </td>
655<td> <code class="code">0</code> </td>
656<td> <code class="code">0</code> </td>
657<td> <code class="code">1</code> </td>
658<td> <code class="code">1</code> </td>
659<td> <code class="code">1</code> </td>
660<td> <code class="code">1</code> </td>
661<td> <code class="code">0</code> </td>
662<td> <span class="bold"><code class="code">0</code></span> </td>
665<td> <code class="code">0</code> </td>
666<td> <code class="code">1</code> </td>
667<td> <code class="code">0</code> </td>
668<td> <code class="code">0</code> </td>
669<td> <code class="code">0</code> </td>
670<td> <code class="code">0</code> </td>
671<td> <code class="code">0</code> </td>
672<td> <span class="bold"><code class="code">1</code></span> </td>
677<p id="idp404848"> Consider, for example, the XML source data stream shown in the first line of <a class="xref" href="#derived">Table IV</a>.
678The remaining lines of this figure show
679            several parallel bit streams that are computed in Parabix-style parsing, with each bit
680            of each stream in one-to-one correspondence to the source character code units of the
681            input stream. For clarity, 1 bits are denoted with 1 in each stream and 0 bits are
682            represented as underscores. The first bit stream shown is that for the opening angle
683            brackets that represent tag openers in XML. The second and third streams show a
684            partition of the tag openers into start tag marks and end tag marks depending on the
685            character immediately following the opener (i.e., "<code class="code">/</code>") or
686            not. The remaining three lines show streams that can be computed in subsequent parsing
687            (using the technique of bitstream addition \cite{cameron-EuroPar2011}), namely streams
688            marking the element names, attribute names and attribute values of tags. </p>
689<div class="table-wrapper" id="derived">
690<p class="title">Table IV</p>
691<div class="caption"><p id="idp408992">XML Source Data and Derived Parallel Bit Streams</p></div>
692<table class="table" xml:id="derived">
693<colgroup span="1">
694<col align="centre" valign="top" span="1">
695<col align="left" valign="top" span="1">
699<td> Source Data </td>
700<td> <code class="code"> &lt;document&gt;fee&lt;element a1='fie' a2 = 'foe'&gt;&lt;/element&gt;fum&lt;/document&gt; </code>
704<td> Tag Openers </td>
705<td> <code class="code">1____________1____________________________1____________1__________</code>
709<td> Start Tag Marks </td>
710<td> <code class="code">_1____________1___________________________________________________</code>
714<td> End Tag Marks </td>
715<td> <code class="code">___________________________________________1____________1_________</code>
719<td> Empty Tag Marks </td>
720<td> <code class="code">__________________________________________________________________</code>
724<td> Element Names </td>
725<td> <code class="code">_11111111_____1111111_____________________________________________</code>
729<td> Attribute Names </td>
730<td> <code class="code">______________________11_______11_________________________________</code>
734<td> Attribute Values </td>
735<td> <code class="code">__________________________111________111__________________________</code>
741<p id="idp421952"> Two intuitions may help explain how the Parabix approach can lead to improved XML
742            parsing performance. The first is that the use of the full register width offers a
743            considerable information advantage over sequential byte-at-a-time parsing. That is,
744            sequential processing of bytes uses just 8 bits of each register, greatly limiting the
745            processor resources that are effectively being used at any one time. The second is that
746            byte-at-a-time loop scanning loops are actually often just computing a single bit of
747            information per iteration: is the scan complete yet? Rather than computing these
748            individual decision-bits, an approach that computes many of them in parallel (e.g., 128
749            bytes at a time using 128-bit registers) should provide substantial benefit. </p>
750<p id="idp423200"> Previous studies have shown that the Parabix approach improves many aspects of XML
751            processing, including transcoding \cite{Cameron2008}, character classification and
752            validation, tag parsing and well-formedness checking. The first Parabix parser used
753            processor bit scan instructions to considerably accelerate sequential scanning loops for
754            individual characters \cite{CameronHerdyLin2008}. Recent work has incorporated a method
755            of parallel scanning using bitstream addition \cite{cameron-EuroPar2011}, as well as
756            combining SIMD methods with 4-stage pipeline parallelism to further improve throughput
757            \cite{HPCA2012}. Although these research prototypes handled the full syntax of
758            schema-less XML documents, they lacked the functionality required by full XML parsers. </p>
759<p id="idp425328"> Commercial XML processors support transcoding of multiple character sets and can
760            parse and validate against multiple document vocabularies. Additionally, they provide
761            API facilities beyond those found in research prototypes, including the widely used SAX,
762            SAX2 and DOM interfaces. </p>
764<div class="section" id="idp426176">
765<h3 class="title" style="clear: both">Sequential vs. Parallel Paradigm</h3>
766<p id="idp426816"> Xerces—like all traditional XML parsers—processes XML documents
767            sequentially. Each character is examined to distinguish between the XML-specific markup,
768            such as a left angle bracket <code class="code">&lt;</code>, and the content held within the
769            document. As the parser progresses through the document, it alternates between markup
770            scanning, validation and content processing modes. </p>
771<p id="idp428384"> In other words, Xerces belongs to an equivalent class applications termed FSM
772            applications\footnote{ Herein FSM applications are considered software systems whose
773            behaviour is defined by the inputs, current state and the events associated with
774            transitions of states.}. Each state transition indicates the processing context of
775            subsequent characters. Unfortunately, textual data tends to be unpredictable and any
776            character could induce a state transition. </p>
777<p id="idp429296"> Parabix-style XML parsers utilize a concept of layered processing. A block of source
778            text is transformed into a set of lexical bitstreams, which undergo a series of
779            operations that can be grouped into logical layers, e.g., transposition, character
780            classification, and lexical analysis. Each layer is pipeline parallel and require
781            neither speculation nor pre-parsing stages\cite{HPCA2012}. To meet the API requirements
782            of the document-ordered Xerces output, the results of the Parabix processing layers must
783            be interleaved to produce the equivalent behaviour. </p>
786<div class="section" id="idp430592">
787<h2 class="title" style="clear: both">Architecture</h2>
788<div class="section" id="idp431264">
789<h3 class="title" style="clear: both">Overview</h3>
790<p id="idp432272"> icXML is more than an optimized version of Xerces. Many components were grouped,
791            restructured and rearchitected with pipeline parallelism in mind. In this section, we
792            highlight the core differences between the two systems. As shown in Figure
793            \ref{fig:xerces-arch}, Xerces is comprised of five main modules: the transcoder, reader,
794            scanner, namespace binder, and validator. The <span class="ital">Transcoder</span> converts source data into UTF-16 before Xerces parses it as XML;
795            the majority of the character set encoding validation is performed as a byproduct of
796            this process. The <span class="ital">Reader</span> is responsible for the
797            streaming and buffering of all raw and transcoded (UTF-16) text. It tracks the current
798            line/column position,
800            performs line-break normalization and validates context-specific character set issues,
801            such as tokenization of qualified-names. The <span class="ital">Scanner</span>
802            pulls data through the reader and constructs the intermediate representation (IR) of the
803            document; it deals with all issues related to entity expansion, validates the XML
804            well-formedness constraints and any character set encoding issues that cannot be
805            completely handled by the reader or transcoder (e.g., surrogate characters, validation
806            and normalization of character references, etc.) The <span class="ital">Namespace
807               Binder</span> is a core piece of the element stack. It handles namespace scoping
808            issues between different XML vocabularies. This allows the scanner to properly select
809            the correct schema grammar structures. The <span class="ital">Validator</span>
810            takes the IR produced by the Scanner (and potentially annotated by the Namespace Binder)
811            and assesses whether the final output matches the user-defined DTD and schema grammar(s)
812            before passing it to the end-user. </p>
813<div class="figure" id="xerces-arch">
814<p class="title">Figure 1: Xerces Architecture</p>
815<div class="figure-contents">
816<div class="mediaobject" id="idp439440"><img alt="png image (xerces.png)" src="xerces.png" width="150cm"></div>
817<div class="caption"></div>
820<p id="idp441808"> In icXML functions are grouped into logical components. As shown in Figure
821             <a class="xref" href="#xerces-arch" title="Xerces Architecture">Figure 1</a>, two major categories exist: (1) the Parabix Subsystem and (2) the
822            Markup Processor. All tasks in (1) use the Parabix Framework \cite{HPCA2012}, which
823            represents data as a set of parallel bitstreams. The <span class="ital">Character Set
824               Adapter</span>, discussed in Section \ref{arch:character-set-adapter}, mirrors
825            Xerces's Transcoder duties; however instead of producing UTF-16 it produces a set of
826            lexical bitstreams, similar to those shown in Figure \ref{fig:parabix1}. These lexical
827            bitstreams are later transformed into UTF-16 in the Content Stream Generator, after
828            additional processing is performed. The first precursor to producing UTF-16 is the
829               <span class="ital">Parallel Markup Parser</span> phase. It takes the lexical
830            streams and produces a set of marker bitstreams in which a 1-bit identifies significant
831            positions within the input data. One bitstream for each of the critical piece of
832            information is created, such as the beginning and ending of start tags, end tags,
833            element names, attribute names, attribute values and content. Intra-element
834            well-formedness validation is performed as an artifact of this process. Like Xerces,
835            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
836            document position(s) through the use of an optimized population count algorithm,
837            described in Section \ref{section:arch:errorhandling}. From here, two data-independent
838            branches exist: the Symbol Resolver and Content Preparation Unit. </p>
839<p id="idp446736"> A typical XML file contains few unique element and attribute names—but
840            each of them will occur frequently. icXML stores these as distinct data structures,
841            called symbols, each with their own global identifier (GID). Using the symbol marker
842            streams produced by the Parallel Markup Parser, the <span class="ital">Symbol
843               Resolver</span> scans through the raw data to produce a sequence of GIDs, called
844            the <span class="ital">symbol stream</span>. </p>
845<p id="idp449328"> The final components of the Parabix Subsystem are the <span class="ital">Content
846               Preparation Unit</span> and <span class="ital">Content Stream
847            Generator</span>. The former takes the (transposed) basis bitstreams and selectively
848            filters them, according to the information provided by the Parallel Markup Parser, and
849            the latter transforms the filtered streams into the tagged UTF-16 <span class="ital">content stream</span>, discussed in Section \ref{section:arch:contentstream}. </p>
850<p id="idp452240"> Combined, the symbol and content stream form icXML's compressed IR of the XML
851            document. The <span class="ital">Markup Processor</span>~parses the IR to
852            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
853            would be too costly to perform in bit space, such as ensuring every start tag has a
854            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
855            that produces a series of URI identifiers (URI IDs), the <span class="ital">URI
856               stream</span>, which are associated with each symbol occurrence. This is
857            discussed in Section \ref{section:arch:namespacehandling}. Finally, the <span class="ital">Validation</span> layer implements the Xerces's validator. However,
858            preprocessing associated with each symbol greatly reduces the work of this stage. </p>
859<div class="figure" id="icxml-arch">
860<p class="title">Figure 2: icXML Architecture</p>
861<div class="figure-contents">
862<div class="mediaobject" id="idp458128"><img alt="png image (icxml.png)" src="icxml.png" width="500cm"></div>
863<div class="caption"></div>
867<div class="section" id="idp460576">
868<h3 class="title" style="clear: both">Character Set Adapters</h3>
869<p id="idp461248"> In Xerces, all input is transcoded into UTF-16 to simplify the parsing costs of
870            Xerces itself and provide the end-consumer with a single encoding format. In the
871            important case of UTF-8 to UTF-16 transcoding, the transcoding costs can be significant,
872            because of the need to decode and classify each byte of input, mapping variable-length
873            UTF-8 byte sequences into 16-bit UTF-16 code units with bit manipulation operations. In
874            other cases, transcoding may involve table look-up operations for each byte of input. In
875            any case, transcoding imposes at least a cost of buffer copying. </p>
876<p id="idp462304"> In icXML, however, the concept of Character Set Adapters (CSAs) is used to minimize
877            transcoding costs. Given a specified input encoding, a CSA is responsible for checking
878            that input code units represent valid characters, mapping the characters of the encoding
879            into the appropriate bitstreams for XML parsing actions (i.e., producing the lexical
880            item streams), as well as supporting ultimate transcoding requirements. All of this work
881            is performed using the parallel bitstream representation of the source input. </p>
882<p id="idp463280"> An important observation is that many character sets are an extension to the legacy
883            7-bit ASCII character set. This includes the various ISO Latin character sets, UTF-8,
884            UTF-16 and many others. Furthermore, all significant characters for parsing XML are
885            confined to the ASCII repertoire. Thus, a single common set of lexical item calculations
886            serves to compute lexical item streams for all such ASCII-based character sets. </p>
887<p id="idp464160"> A second observation is that—regardless of which character set is
888            used—quite often all of the characters in a particular block of input will be
889            within the ASCII range. This is a very simple test to perform using the bitstream
890            representation, simply confirming that the bit 0 stream is zero for the entire block.
891            For blocks satisfying this test, all logic dealing with non-ASCII characters can simply
892            be skipped. Transcoding to UTF-16 becomes trivial as the high eight bitstreams of the
893            UTF-16 form are each set to zero in this case. </p>
894<p id="idp466080"> A third observation is that repeated transcoding of the names of XML elements,
895            attributes and so on can be avoided by using a look-up mechanism. That is, the first
896            occurrence of each symbol is stored in a look-up table mapping the input encoding to a
897            numeric symbol ID. Transcoding of the symbol is applied at this time. Subsequent look-up
898            operations can avoid transcoding by simply retrieving the stored representation. As
899            symbol look up is required to apply various XML validation rules, there is achieves the
900            effect of transcoding each occurrence without additional cost. </p>
901<p id="idp467136"> The cost of individual character transcoding is avoided whenever a block of input is
902            confined to the ASCII subset and for all but the first occurrence of any XML element or
903            attribute name. Furthermore, when transcoding is required, the parallel bitstream
904            representation supports efficient transcoding operations. In the important case of UTF-8
905            to UTF-16 transcoding, the corresponding UTF-16 bitstreams can be calculated in bit
906            parallel fashion based on UTF-8 streams \cite{Cameron2008}, and all but the final bytes
907            of multi-byte sequences can be marked for deletion as discussed in the following
908            subsection. In other cases, transcoding within a block only need be applied for
909            non-ASCII bytes, which are conveniently identified by iterating through the bit 0 stream
910            using bit scan operations. </p>
912<div class="section" id="idp468560">
913<h3 class="title" style="clear: both">Combined Parallel Filtering</h3>
914<p id="idp469248"> As just mentioned, UTF-8 to UTF-16 transcoding involves marking all but the last
915            bytes of multi-byte UTF-8 sequences as positions for deletion. For example, the two
916            Chinese characters <code class="code">䜠奜</code> are represented as two
917            three-byte UTF-8 sequences <code class="code">E4 BD A0</code> and <code class="code">E5 A5 BD</code> while the
918            UTF-16 representation must be compressed down to the two code units <code class="code">4F60</code>
919            and <code class="code">597D</code>. In the bit parallel representation, this corresponds to a
920            reduction from six bit positions representing UTF-8 code units (bytes) down to just two
921            bit positions representing UTF-16 code units (double bytes). This compression may be
922            achieved by arranging to calculate the correct UTF-16 bits at the final position of each
923            sequence and creating a deletion mask to mark the first two bytes of each 3-byte
924            sequence for deletion. In this case, the portion of the mask corresponding to these
925            input bytes is the bit sequence <code class="code">110110</code>. Using this approach, transcoding
926            may then be completed by applying parallel deletion and inverse transposition of the
927            UTF-16 bitstreams\cite{Cameron2008}. </p>
928<p id="idp473408"> Rather than immediately paying the costs of deletion and transposition just for
929            transcoding, however, icXML defers these steps so that the deletion masks for several
930            stages of processing may be combined. In particular, this includes core XML requirements
931            to normalize line breaks and to replace character reference and entity references by
932            their corresponding text. In the case of line break normalization, all forms of line
933            breaks, including bare carriage returns (CR), line feeds (LF) and CR-LF combinations
934            must be normalized to a single LF character in each case. In icXML, this is achieved by
935            first marking CR positions, performing two bit parallel operations to transform the
936            marked CRs into LFs, and then marking for deletion any LF that is found immediately
937            after the marked CR as shown by the Pablo source code in
938              <a class="xref" href="#fig-LBnormalization">Figure 3</a>.
939              <div class="figure" id="fig-LBnormalization">
940<p class="title">Figure 3</p>
941<div class="figure-contents">
942<div class="caption">Line Break Normalization Logic</div>
943<pre class="programlisting" id="idp477488">
944# XML 1.0 line-break normalization rules.
945if lex.CR:
946# Modify CR (#x0D) to LF (#x0A)
947  u16lo.bit_5 ^= lex.CR
948  u16lo.bit_6 ^= lex.CR
949  u16lo.bit_7 ^= lex.CR
950  CRLF = pablo.Advance(lex.CR) &amp; lex.LF
951  callouts.delmask |= CRLF
952# Adjust LF streams for line/column tracker
953  lex.LF |= lex.CR
954  lex.LF ^= CRLF
958         </p>
959<p id="idp478832"> In essence, the deletion masks for transcoding and for line break normalization each
960            represent a bitwise filter; these filters can be combined using bitwise-or so that the
961            parallel deletion algorithm need only be applied once. </p>
962<p id="idp479488"> A further application of combined filtering is the processing of XML character and
963            entity references. Consider, for example, the references <code class="code">&amp;</code> or
964               <code class="code">&lt;</code>. which must be replaced in XML processing with the single
965               <code class="code">&amp;</code> and <code class="code">&lt;</code> characters, respectively. The
966            approach in icXML is to mark all but the first character positions of each reference for
967            deletion, leaving a single character position unmodified. Thus, for the references
968               <code class="code">&amp;</code> or <code class="code">&lt;</code> the masks <code class="code">01111</code> and
969               <code class="code">011111</code> are formed and combined into the overall deletion mask. After the
970            deletion and inverse transposition operations are finally applied, a post-processing
971            step inserts the proper character at these positions. One note about this process is
972            that it is speculative; references are assumed to generally be replaced by a single
973            UTF-16 code unit. In the case, that this is not true, it is addressed in
974            post-processing. </p>
975<p id="idp484304"> The final step of combined filtering occurs during the process of reducing markup
976            data to tag bytes preceding each significant XML transition as described in
977            section~\ref{section:arch:contentstream}. Overall, icXML avoids separate buffer copying
978            operations for each of the these filtering steps, paying the cost of parallel deletion
979            and inverse transposition only once. Currently, icXML employs the parallel-prefix
980            compress algorithm of Steele~\cite{HackersDelight} Performance is independent of the
981            number of positions deleted. Future versions of icXML are expected to take advantage of
982            the parallel extract operation~\cite{HilewitzLee2006} that Intel is now providing in its
983            Haswell architecture. </p>
985<div class="section" id="idp485632">
986<h3 class="title" style="clear: both">Content Stream</h3>
987<p id="idp486304"> A relatively-unique concept for icXML is the use of a filtered content stream.
988            Rather that parsing an XML document in its original format, the input is transformed
989            into one that is easier for the parser to iterate through and produce the sequential
990            output. In , the source data
992            is transformed into
994            through the parallel filtering algorithm, described in section \ref{sec:parfilter}. </p>
995<p id="idp488816"> Combined with the symbol stream, the parser traverses the content stream to
996            effectively reconstructs the input document in its output form. The initial <span class="ital">0</span> indicates an empty content string. The following
997               <code class="code">&gt;</code> indicates that a start tag without any attributes is the first
998            element in this text and the first unused symbol, <code class="code">document</code>, is the element
999            name. Succeeding that is the content string <code class="code">fee</code>, which is null-terminated
1000            in accordance with the Xerces API specification. Unlike Xerces, no memory-copy
1001            operations are required to produce these strings, which as
1002            Figure~\ref{fig:xerces-profile} shows accounts for 6.83% of Xerces's execution time.
1003            Additionally, it is cheap to locate the terminal character of each string: using the
1004            String End bitstream, the Parabix Subsystem can effectively calculate the offset of each
1005            null character in the content stream in parallel, which in turn means the parser can
1006            directly jump to the end of every string without scanning for it. </p>
1007<p id="idp492208"> Following <code class="code">'fee'</code> is a <code class="code">=</code>, which marks the
1008            existence of an attribute. Because all of the intra-element was performed in the Parabix
1009            Subsystem, this must be a legal attribute. Since attributes can only occur within start
1010            tags and must be accompanied by a textual value, the next symbol in the symbol stream
1011            must be the element name of a start tag, and the following one must be the name of the
1012            attribute and the string that follows the <code class="code">=</code> must be its value. However, the
1013            subsequent <code class="code">=</code> is not treated as an independent attribute because the parser
1014            has yet to read a <code class="code">&gt;</code>, which marks the end of a start tag. Thus only
1015            one symbol is taken from the symbol stream and it (along with the string value) is added
1016            to the element. Eventually the parser reaches a <code class="code">/</code>, which marks the
1017            existence of an end tag. Every end tag requires an element name, which means they
1018            require a symbol. Inter-element validation whenever an empty tag is detected to ensure
1019            that the appropriate scope-nesting rules have been applied. </p>
1021<div class="section" id="idp496352">
1022<h3 class="title" style="clear: both">Namespace Handling</h3>
1023<p id="idp497440"> In XML, namespaces prevents naming conflicts when multiple vocabularies are used
1024            together. It is especially important when a vocabulary application-dependant meaning,
1025            such as when XML or SVG documents are embedded within XHTML files. Namespaces are bound
1026            to uniform resource identifiers (URIs), which are strings used to identify specific
1027            names or resources. On line 1 in the Table below, the <code class="code">xmlns</code>
1028            attribute instructs the XML processor to bind the prefix <code class="code">p</code> to the URI
1029               '<code class="code"></code>' and the default (empty) prefix to
1030               <code class="code"></code>. Thus to the XML processor, the <code class="code">title</code> on line 2
1031            and <code class="code">price</code> on line 4 both read as
1032            <code class="code">"":title</code> and
1033               <code class="code">"":price</code> respectively, whereas on line 3 and
1034            5, <code class="code">p:name</code> and <code class="code">price</code> are seen as
1035               <code class="code">"":name</code> and
1036               <code class="code">"":price</code>. Even though the actual element name
1037               <code class="code">price</code>, due to namespace scoping rules they are viewed as two
1038            uniquely-named items because the current vocabulary is determined by the namespace(s)
1039            that are in-scope. </p>
1040<div class="table-wrapper" id="idp504560">
1041<p class="title">Table V</p>
1042<div class="caption"><p id="idp505072">XML Namespace Example</p></div>
1043<table class="table">
1044<colgroup span="1">
1045<col align="centre" valign="top" span="1">
1046<col align="left" valign="top" span="1">
1050<td>1. </td>
1051<td>&lt;book xmlns:p="" xmlns=""&gt; </td>
1054<td>2. </td>
1055<td>  &lt;title&gt;BOOK NAME&lt;/title&gt; </td>
1058<td>3. </td>
1059<td>  &lt;p:name&gt;PUBLISHER NAME&lt;/p:name&gt; </td>
1062<td>4. </td>
1063<td>  &lt;price&gt;X&lt;/price&gt; </td>
1066<td>5. </td>
1067<td>  &lt;price xmlns=""&gt;Y&lt;/price&gt; </td>
1070<td>6. </td>
1071<td>&lt;/book&gt; </td>
1076<p id="idp514048"> In both Xerces and icXML, every URI has a one-to-one mapping to a URI ID. These
1077            persist for the lifetime of the application through the use of a global URI pool. Xerces
1078            maintains a stack of namespace scopes that is pushed (popped) every time a start tag
1079            (end tag) occurs in the document. Because a namespace declaration affects the entire
1080            element, it must be processed prior to grammar validation. This is a costly process
1081            considering that a typical namespaced XML document only comes in one of two forms: (1)
1082            those that declare a set of namespaces upfront and never change them, and (2) those that
1083            repeatedly modify the namespaces in predictable patterns. </p>
1084<p id="idp515184"> For that reason, icXML contains an independent namespace stack and utilizes bit
1085            vectors to cheaply perform
1086             When a prefix is
1087            declared (e.g., <code class="code">xmlns:p=""</code>), a namespace binding
1088            is created that maps the prefix (which are assigned Prefix IDs in the symbol resolution
1089            process) to the URI. Each unique namespace binding has a unique namespace id (NSID) and
1090            every prefix contains a bit vector marking every NSID that has ever been associated with
1091            it within the document. For example, in Table \ref{tbl:namespace1}, the prefix binding
1092            set of <code class="code">p</code> and <code class="code">xmlns</code> would be <code class="code">01</code> and
1093            <code class="code">11</code> respectively. To resolve the in-scope namespace binding for each prefix,
1094            a bit vector of the currently visible namespaces is maintained by the system. By ANDing
1095            the prefix bit vector with the currently visible namespaces, the in-scope NSID can be
1096            found using a bit-scan intrinsic. A namespace binding table, similar to Table
1097            \ref{tbl:namespace1}, provides the actual URI ID. </p>
1098<div class="table-wrapper" id="idp519648">
1099<p class="title">Table VI</p>
1100<div class="caption"><p id="idp520160">Namespace Binding Table Example</p></div>
1101<table class="table">
1102<colgroup span="1">
1103<col align="centre" valign="top" span="1">
1104<col align="centre" valign="top" span="1">
1105<col align="centre" valign="top" span="1">
1106<col align="centre" valign="top" span="1">
1107<col align="centre" valign="top" span="1">
1110<th>NSID </th>
1111<th> Prefix </th>
1112<th> URI </th>
1113<th> Prefix ID </th>
1114<th> URI ID </th>
1118<td>0 </td>
1119<td> <code class="code"> p</code> </td>
1120<td> <code class="code"></code> </td>
1121<td> 0 </td>
1122<td> 0 </td>
1125<td>1 </td>
1126<td> <code class="code"> xmlns</code> </td>
1127<td> <code class="code"></code> </td>
1128<td> 1 </td>
1129<td> 1 </td>
1132<td>2 </td>
1133<td> <code class="code"> xmlns</code> </td>
1134<td> <code class="code"></code> </td>
1135<td> 1 </td>
1136<td> 0 </td>
1141<p id="idp536240">
1146         </p>
1147<p id="idp538224"> To ensure that scoping rules are adhered to, whenever a start tag is encountered,
1148            any modification to the currently visible namespaces is calculated and stored within a
1149            stack of bit vectors denoting the locally modified namespace bindings. When an end tag
1150            is found, the currently visible namespaces is XORed with the vector at the top of the
1151            stack. This allows any number of changes to be performed at each scope-level with a
1152            constant time.
1154         </p>
1156<div class="section" id="idp539680">
1157<h3 class="title" style="clear: both">Error Handling</h3>
1158<p id="idp540352">
1160            Xerces outputs error messages in two ways: through the programmer API and as thrown
1161            objects for fatal errors. As Xerces parses a file, it uses context-dependant logic to
1162            assess whether the next character is legal; if not, the current state determines the
1163            type and severity of the error. icXML emits errors in the similar manner—but
1164            how it discovers them is substantially different. Recall that in Figure
1165            \ref{fig:icxml-arch}, icXML is divided into two sections: the Parabix Subsystem and
1166            Markup Processor, each with its own system for detecting and producing error messages. </p>
1167<p id="idp541984"> Within the Parabix Subsystem, all computations are performed in parallel, a block at
1168            a time. Errors are derived as artifacts of bitstream calculations, with a 1-bit marking
1169            the byte-position of an error within a block, and the type of error is determined by the
1170            equation that discovered it. The difficulty of error processing in this section is that
1171            in Xerces the line and column number must be given with every error production. Two
1172            major issues exist because of this: (1) line position adheres to XML white-normalization
1173            rules; as such, some sequences of characters, e.g., a carriage return followed by a line
1174            feed, are counted as a single new line character. (2) column position is counted in
1175            characters, not bytes or code units; thus multi-code-unit code-points and surrogate
1176            character pairs are all counted as a single column position. Note that typical XML
1177            documents are error-free but the calculation of the line/column position is a constant
1178            overhead in Xerces.  To
1179            reduce this, icXML pushes the bulk cost of the line/column calculation to the occurrence
1180            of the error and performs the minimal amount of book-keeping necessary to facilitate it.
1181            icXML leverages the byproducts of the Character Set Adapter (CSA) module and amalgamates
1182            the information within the Line Column Tracker (LCT). One of the CSA's major
1183            responsibilities is transcoding an input text.
1184             During this process,
1185            white-space normalization rules are applied and multi-code-unit and surrogate characters
1186            are detected and validated. A <span class="ital">line-feed bitstream</span>,
1187            which marks the positions of the normalized new lines characters, is a natural
1188            derivative of this process. Using an optimized population count algorithm, the line
1189            count can be summarized cheaply for each valid block of text.
1190             Column position is more
1191            difficult to calculate. It is possible to scan backwards through the bitstream of new
1192            line characters to determine the distance (in code-units) between the position between
1193            which an error was detected and the last line feed. However, this distance may exceed
1194            than the actual character position for the reasons discussed in (2). To handle this, the
1195            CSA generates a <span class="ital">skip mask</span> bitstream by ORing together
1196            many relevant bitstreams, such as all trailing multi-code-unit and surrogate characters,
1197            and any characters that were removed during the normalization process. When an error is
1198            detected, the sum of those skipped positions is subtracted from the distance to
1199            determine the actual column number. </p>
1200<p id="idp547472"> The Markup Processor is a state-driven machine. As such, error detection within it
1201            is very similar to Xerces. However, reporting the correct line/column is a much more
1202            difficult problem. The Markup Processor parses the content stream, which is a series of
1203            tagged UTF-16 strings. Each string is normalized in accordance with the XML
1204            specification. All symbol data and unnecessary whitespace is eliminated from the stream;
1205            thus its impossible to derive the current location using only the content stream. To
1206            calculate the location, the Markup Processor borrows three additional pieces of
1207            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
1208            (code-unit) position of every datum that was suppressed from the source during the
1209            production of the content stream. Armed with these, it is possible to calculate the
1210            actual line/column using the same system as the Parabix Subsystem until the sum of the
1211            negated deletion mask stream is equal to the current position. </p>
1214<div class="section" id="idp549968">
1215<h2 class="title" style="clear: both">Multithreading with Pipeline Parallelism</h2>
1216<p id="idp550608"> As discussed in section \ref{background:xerces}, Xerces can be considered a FSM
1217         application. These are "embarrassingly
1218         sequential."\cite{Asanovic:EECS-2006-183} and notoriously difficult to
1219         parallelize. However, icXML is designed to organize processing into logical layers. In
1220         particular, layers within the Parabix Subsystem are designed to operate over significant
1221         segments of input data before passing their outputs on for subsequent processing. This fits
1222         well into the general model of pipeline parallelism, in which each thread is in charge of a
1223         single module or group of modules. </p>
1224<p id="idp552464"> The most straightforward division of work in icXML is to separate the Parabix Subsystem
1225         and the Markup Processor into distinct logical layers into two separate stages. The
1226         resultant application, <span class="ital">icXML-p</span>, is a course-grained
1227         software-pipeline application. In this case, the Parabix Subsystem thread
1228               <code class="code">T<sub>1</sub></code> reads 16k of XML input <code class="code">I</code> at a
1229         time and produces the content, symbol and URI streams, then stores them in a pre-allocated
1230         shared data structure <code class="code">S</code>. The Markup Processor thread
1231            <code class="code">T<sub>2</sub></code> consumes <code class="code">S</code>, performs well-formedness
1232         and grammar-based validation, and the provides parsed XML data to the application through
1233         the Xerces API. The shared data structure is implemented using a ring buffer, where every
1234         entry contains an independent set of data streams. In the examples of Figure
1235         \ref{threads_timeline1} and \ref{threads_timeline2}, the ring buffer has four entries. A
1236         lock-free mechanism is applied to ensure that each entry can only be read or written by one
1237         thread at the same time. In Figure \ref{threads_timeline1} the processing time of
1238               <code class="code">T<sub>1</sub></code> is longer than
1239         <code class="code">T<sub>2</sub></code>; thus <code class="code">T<sub>2</sub></code> always
1240         waits for <code class="code">T<sub>1</sub></code> to write to the shared memory. Figure
1241         \ref{threads_timeline2} illustrates the scenario in which
1242         <code class="code">T<sub>1</sub></code> is faster and must wait for
1243            <code class="code">T<sub>2</sub></code> to finish reading the shared data before it can
1244         reuse the memory space. </p>
1245<p id="idp561584">
1246        <div class="figure" id="threads_timeline1">
1247<p class="title">Figure 4: Thread Balance in Two-Stage Pipelines</p>
1248<div class="figure-contents">
1249<div class="mediaobject" id="idp562976"><img alt="png image (threads_timeline1.png)" src="threads_timeline1.png" width="500cm"></div>
1250<div class="mediaobject" id="idp564752"><img alt="png image (threads_timeline2.png)" src="threads_timeline2.png" width="500cm"></div>
1251<div class="caption"></div>
1254      </p>
1255<p id="idp567200"> Overall, our design is intended to benefit a range of applications. Conceptually, we
1256         consider two design points. The first, the parsing performed by the Parabix Subsystem
1257         dominates at 67% of the overall cost, with the cost of application processing (including
1258         the driver logic within the Markup Processor) at 33%. The second is almost the opposite
1259         scenario, the cost of application processing dominates at 60%, while the cost of XML
1260         parsing represents an overhead of 40%. </p>
1261<p id="idp568112"> Our design is predicated on a goal of using the Parabix framework to achieve a 50% to
1262         100% improvement in the parsing engine itself. In a best case scenario, a 100% improvement
1263         of the Parabix Subsystem for the design point in which XML parsing dominates at 67% of the
1264         total application cost. In this case, the single-threaded icXML should achieve a 1.5x
1265         speedup over Xerces so that the total application cost reduces to 67% of the original.
1266         However, in icXML-p, our ideal scenario gives us two well-balanced threads each performing
1267         about 33% of the original work. In this case, Amdahl's law predicts that we could expect up
1268         to a 3x speedup at best. </p>
1269<p id="idp569232"> At the other extreme of our design range, we consider an application in which core
1270         parsing cost is 40%. Assuming the 2x speedup of the Parabix Subsystem over the
1271         corresponding Xerces core, single-threaded icXML delivers a 25% speedup. However, the most
1272         significant aspect of our two-stage multi-threaded design then becomes the ability to hide
1273         the entire latency of parsing within the serial time required by the application. In this
1274         case, we achieve an overall speedup in processing time by 1.67x. </p>
1275<p id="idp570176"> Although the structure of the Parabix Subsystem allows division of the work into
1276         several pipeline stages and has been demonstrated to be effective for four pipeline stages
1277         in a research prototype \cite{HPCA2012}, our analysis here suggests that the further
1278         pipelining of work within the Parabix Subsystem is not worthwhile if the cost of
1279         application logic is little as 33% of the end-to-end cost using Xerces. To achieve benefits
1280         of further parallelization with multi-core technology, there would need to be reductions in
1281         the cost of application logic that could match reductions in core parsing cost. </p>
1283<div class="section" id="idp572016">
1284<h2 class="title" style="clear: both">Performance</h2>
1285<p id="idp572688"> We evaluate Xerces-C++ 3.1.1, icXML, icXML-p against two benchmarking applications: the
1286         Xerces C++ SAXCount sample application, and a real world GML to SVG transformation
1287         application. We investigated XML parser performance using an Intel Core i7 quad-core (Sandy
1288         Bridge) processor (3.40GHz, 4 physical cores, 8 threads (2 per core), 32+32 kB (per core)
1289         L1 cache, 256 kB (per core) L2 cache, 8 MB L3 cache) running the 64-bit version of Ubuntu
1290         12.04 (Linux). </p>
1291<p id="idp573600"> We analyzed the execution profiles of each XML parser using the performance counters
1292         found in the processor. We chose several key hardware events that provide insight into the
1293         profile of each application and indicate if the processor is doing useful work. The set of
1294         events included in our study are: processor cycles, branch instructions, branch
1295         mispredictions, and cache misses. The Performance Application Programming Interface (PAPI)
1296         Version 5.5.0 \cite{papi} toolkit was installed on the test system to facilitate the
1297         collection of hardware performance monitoring statistics. In addition, we used the Linux
1298         perf \cite{perf} utility to collect per core hardware events. </p>
1299<div class="section" id="idp574736">
1300<h3 class="title" style="clear: both">Xerces C++ SAXCount</h3>
1301<p id="idp575408"> Xerces comes with sample applications that demonstrate salient features of the
1302            parser. SAXCount is the simplest such application: it counts the elements, attributes
1303            and characters of a given XML file using the (event based) SAX API and prints out the
1304            totals. </p>
1305<p id="idp576112"> Table \ref{XMLDocChars} shows the document characteristics of the XML input files
1306            selected for the Xerces C++ SAXCount benchmark. The jaw.xml represents document-oriented
1307            XML inputs and contains the three-byte and four-byte UTF-8 sequence required for the
1308            UTF-8 encoding of Japanese characters. The remaining data files are data-oriented XML
1309            documents and consist entirely of single byte encoded ASCII characters.
1310  <div class="table-wrapper" id="idp576848">
1311<p class="title">Table VII</p>
1312<div class="caption"><p id="idp577360">XML Document Characteristics</p></div>
1313<table class="table">
1314<colgroup span="1">
1315<col align="left" valign="top" span="1">
1316<col align="centre" valign="top" span="1">
1317<col align="centre" valign="top" span="1">
1318<col align="centre" valign="top" span="1">
1319<col align="centre" valign="top" span="1">
1323<td>File Name           </td>
1324<td> jaw.xml            </td>
1325<td> road.gml   </td>
1326<td> po.xml     </td>
1327<td> soap.xml </td>
1330<td>File Type           </td>
1331<td> document           </td>
1332<td> data               </td>
1333<td> data               </td>
1334<td> data        </td>
1337<td>File Size (kB)              </td>
1338<td> 7343                       </td>
1339<td> 11584      </td>
1340<td> 76450              </td>
1341<td> 2717 </td>
1344<td>Markup Item Count   </td>
1345<td> 74882              </td>
1346<td> 280724     </td>
1347<td> 4634110    </td>
1348<td> 18004 </td>
1351<td>Markup Density              </td>
1352<td> 0.13                       </td>
1353<td> 0.57       </td>
1354<td> 0.76               </td>
1355<td> 0.87       </td>
1361<p id="idp592944"> A key predictor of the overall parsing performance of an XML file is markup
1362            density\footnote{ Markup Density: the ratio of markup bytes used to define the structure
1363            of the document vs. its file size.}. This metric has substantial influence on the
1364            performance of traditional recursive descent XML parsers because it directly corresponds
1365            to the number of state transitions that occur when parsing a document. We use a mixture
1366            of document-oriented and data-oriented XML files to analyze performance over a spectrum
1367            of markup densities. </p>
1368<p id="idp593952"> Figure \ref{perf_SAX} compares the performance of Xerces, icXML and pipelined icXML
1369            in terms of CPU cycles per byte for the SAXCount application. The speedup for icXML over
1370            Xerces is 1.3x to 1.8x. With two threads on the multicore machine, icXML-p can achieve
1371            speedup up to 2.7x. Xerces is substantially slowed by dense markup but icXML is less
1372            affected through a reduction in branches and the use of parallel-processing techniques.
1373            icXML-p performs better as markup-density increases because the work performed by each
1374            stage is well balanced in this application. </p>
1375<p id="idp594992">
1376        <div class="figure" id="perf_SAX">
1377<p class="title">Figure 5: SAXCount Performance Comparison</p>
1378<div class="figure-contents">
1379<div class="mediaobject" id="idp596336"><img alt="png image (perf_SAX.png)" src="perf_SAX.png" width="500cm"></div>
1380<div class="caption"></div>
1383         </p>
1385<div class="section" id="idp598880">
1386<h3 class="title" style="clear: both">GML2SVG</h3>
1387<p id="idp599552">       As a more substantial application of XML processing, the GML-to-SVG (GML2SVG) application
1388was chosen.   This application transforms geospatially encoded data represented using
1389an XML representation in the form of Geography Markup Language (GML) \cite{lake2004geography}
1390into a different XML format  suitable for displayable maps:
1391Scalable Vector Graphics (SVG) format\cite{lu2007advances}. In the GML2SVG benchmark, GML feature elements
1392and GML geometry elements tags are matched. GML coordinate data are then extracted
1393and transformed to the corresponding SVG path data encodings.
1394Equivalent SVG path elements are generated and output to the destination
1395SVG document.  The GML2SVG application is thus considered typical of a broad
1396class of XML applications that parse and extract information from
1397a known XML format for the purpose of analysis and restructuring to meet
1398the requirements of an alternative format.</p>
1399<p id="idp600880">Our GML to SVG data translations are executed on GML source data
1400modelling the city of Vancouver, British Columbia, Canada.
1401The GML source document set
1402consists of 46 distinct GML feature layers ranging in size from approximately 9 KB to 125.2 MB
1403and with an average document size of 18.6 MB. Markup density ranges from approximately 0.045 to 0.719
1404and with an average markup density of 0.519. In this performance study,
1405213.4 MB of source GML data generates 91.9 MB of target SVG data.</p>
1406<div class="figure" id="perf_GML2SVG">
1407<p class="title">Figure 6: Performance Comparison for GML2SVG</p>
1408<div class="figure-contents">
1409<div class="mediaobject" id="idp602864"><img alt="png image (Throughput.png)" src="Throughput.png" width="500cm"></div>
1410<div class="caption"></div>
1413<p id="idp605152">Figure \ref{perf_GML2SVG} compares the performance of the GML2SVG application linked against
1414the Xerces, icXML and icXML-p.   
1415On the GML workload with this application, single-thread icXML
1416achieved about a 50% acceleration over Xerces,
1417increasing throughput on our test machine from 58.3 MB/sec to 87.9 MB/sec.   
1418Using icXML-p, a further throughput increase to 111 MB/sec was recorded,
1419approximately a 2X speedup.</p>
1420<p id="idp605968">An important aspect of icXML is the replacement of much branch-laden
1421sequential code inside Xerces with straight-line SIMD code using far
1422fewer branches.  Figure \ref{branchmiss_GML2SVG} shows the corresponding
1423improvement in branching behaviour, with a dramatic reduction in branch misses per kB.
1424It is also interesting to note that icXML-p goes even further.   
1425In essence, in using pipeline parallelism to split the instruction
1426stream onto separate cores, the branch target buffers on each core are
1427less overloaded and able to increase the successful branch prediction rate.</p>
1428<div class="figure" id="branchmiss_GML2SVG">
1429<p class="title">Figure 7: Comparative Branch Misprediction Rate</p>
1430<div class="figure-contents">
1431<div class="mediaobject" id="idp30880"><img alt="png image (BM.png)" src="BM.png" width="500cm"></div>
1432<div class="caption"></div>
1435<p id="idp33168">The behaviour of the three versions with respect to L1 cache misses per kB is shown
1436in Figure \ref{cachemiss_GML2SVG}.   Improvements are shown in both instruction-
1437and data-cache performance with the improvements in instruction-cache
1438behaviour the most dramatic.   Single-threaded icXML shows substantially improved
1439performance over Xerces on both measures.   
1440Although icXML-p is slightly worse with respect to data-cache performance,
1441this is more than offset by a further dramatic reduction in instruction-cache miss rate.
1442Again partitioning the instruction stream through the pipeline parallelism model has
1443significant benefit.</p>
1444<div class="figure" id="cachemiss_GML2SVG">
1445<p class="title">Figure 8: Comparative Cache Miss Rate</p>
1446<div class="figure-contents">
1447<div class="mediaobject" id="idp35296"><img alt="png image (CM.png)" src="CM.png" width="500cm"></div>
1448<div class="caption"></div>
1451<p id="idp37584">One caveat with this study is that the GML2SVG application did not exhibit
1452a relative balance of processing between application code and Xerces library
1453code reaching the 33% figure.  This suggests that for this application and
1454possibly others, further separating the logical layers of the
1455icXML engine into different pipeline stages could well offer significant benefit.
1456This remains an area of ongoing work.</p>
1459<div class="section" id="idp624032">
1460<h2 class="title" style="clear: both">Conclusion and Future Work</h2>
1461<p id="idp624720"> This paper is the first case study documenting the significant performance benefits
1462         that may be realized through the integration of parallel bitstream technology into existing
1463         widely-used software libraries. In the case of the Xerces-C++ XML parser, the combined
1464         integration of SIMD and multicore parallelism was shown capable of dramatic producing
1465         dramatic increases in throughput and reductions in branch mispredictions and cache misses.
1466         The modified parser, going under the name icXML is designed to provide the full
1467         functionality of the original Xerces library with complete compatibility of APIs. Although
1468         substantial re-engineering was required to realize the performance potential of parallel
1469         technologies, this is an important case study demonstrating the general feasibility of
1470         these techniques. </p>
1471<p id="idp626000"> The further development of icXML to move beyond 2-stage pipeline parallelism is
1472         ongoing, with realistic prospects for four reasonably balanced stages within the library.
1473         For applications such as GML2SVG which are dominated by time spent on XML parsing, such a
1474         multistage pipelined parsing library should offer substantial benefits. </p>
1475<p id="idp626768"> The example of XML parsing may be considered prototypical of finite-state machines
1476         applications which have sometimes been considered "embarassingly
1477         sequential" and so difficult to parallelize that "nothing
1478         works." So the case study presented here should be considered an important data
1479         point in making the case that parallelization can indeed be helpful across a broad array of
1480         application types. </p>
1481<p id="idp628144"> To overcome the software engineering challenges in applying parallel bitstream
1482         technology to existing software systems, it is clear that better library and tool support
1483         is needed. The techniques used in the implementation of icXML and documented in this paper
1484         could well be generalized for applications in other contexts and automated through the
1485         creation of compiler technology specifically supporting parallel bitstream programming.
1486      </p>
1488<div class="bibliography" id="idp629600">
1489<h2 class="title" style="clear:both">Bibliography</h2>
1490<p class="bibliomixed" id="XMLChip09">[Leventhal and Lemoine 2009] Leventhal, Michael and
1491         Eric Lemoine 2009. The XML chip at 6 years. Proceedings of International Symposium on
1492         Processing XML Efficiently 2009, Montréal.</p>
1493<p class="bibliomixed" id="Datapower09">[Salz, Achilles and Maze 2009] Salz, Richard,
1494         Heather Achilles, and David Maze. 2009. Hardware and software trade-offs in the IBM
1495         DataPower XML XG4 processor card. Proceedings of International Symposium on Processing XML
1496         Efficiently 2009, Montréal.</p>
1497<p class="bibliomixed" id="PPoPP08">[Cameron 2007] Cameron, Robert D. 2007. A Case Study
1498         in SIMD Text Processing with Parallel Bit Streams UTF-8 to UTF-16 Transcoding. Proceedings
1499         of 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming 2008, Salt
1500         Lake City, Utah. On the Web at <a href="" class="link" target="_new"></a>.</p>
1501<p class="bibliomixed" id="CASCON08">[Cameron, Herdy and Lin 2008] Cameron, Robert D.,
1502         Kenneth S Herdy, and Dan Lin. 2008. High Performance XML Parsing Using Parallel Bit Stream
1503         Technology. Proceedings of CASCON 2008. 13th ACM SIGPLAN Symposium on Principles and
1504         Practice of Parallel Programming 2008, Toronto.</p>
1505<p class="bibliomixed" id="SVGOpen08">[Herdy, Burggraf and Cameron 2008] Herdy, Kenneth
1506         S., Robert D. Cameron and David S. Burggraf. 2008. High Performance GML to SVG
1507         Transformation for the Visual Presentation of Geographic Data in Web-Based Mapping Systems.
1508         Proceedings of SVG Open 6th International Conference on Scalable Vector Graphics,
1509         Nuremburg. On the Web at
1510            <a href="" class="link" target="_new"></a>.</p>
1511<p class="bibliomixed" id="Ross06">[Ross 2006] Ross, Kenneth A. 2006. Efficient hash
1512         probes on modern processors. Proceedings of ICDE, 2006. ICDE 2006, Atlanta. On the Web at
1513            <a href="" class="link" target="_new"></a>.</p>
1514<p class="bibliomixed" id="ASPLOS09">[Cameron and Lin 2009] Cameron, Robert D. and Dan
1515         Lin. 2009. Architectural Support for SWAR Text Processing with Parallel Bit Streams: The
1516         Inductive Doubling Principle. Proceedings of ASPLOS 2009, Washington, DC.</p>
1517<p class="bibliomixed" id="Wu08">[Wu et al. 2008] Wu, Yu, Qi Zhang, Zhiqiang Yu and
1518         Jianhui Li. 2008. A Hybrid Parallel Processing for XML Parsing and Schema Validation.
1519         Proceedings of Balisage 2008, Montréal. On the Web at
1520            <a href="" class="link" target="_new"></a>.</p>
1521<p class="bibliomixed" id="u8u16">[Cameron 2008] u8u16 - A High-Speed UTF-8 to UTF-16
1522         Transcoder Using Parallel Bit Streams Technical Report 2007-18. 2007. School of Computing
1523         Science Simon Fraser University, June 21 2007.</p>
1524<p class="bibliomixed" id="XML10">[XML 1.0] Extensible Markup Language (XML) 1.0 (Fifth
1525         Edition) W3C Recommendation 26 November 2008. On the Web at
1526            <a href="" class="link" target="_new"></a>.</p>
1527<p class="bibliomixed" id="Unicode">[Unicode] The Unicode Consortium. 2009. On the Web at
1528            <a href="" class="link" target="_new"></a>.</p>
1529<p class="bibliomixed" id="Pex06">[Hilewitz and Lee 2006]  Hilewitz, Y. and Ruby B. Lee.
1530         2006. Fast Bit Compression and Expansion with Parallel Extract and Parallel Deposit
1531         Instructions. Proceedings of the IEEE 17th International Conference on Application-Specific
1532         Systems, Architectures and Processors (ASAP), pp. 65-72, September 11-13, 2006.</p>
1533<p class="bibliomixed" id="InfoSet">[XML Infoset] XML Information Set (Second Edition) W3C
1534         Recommendation 4 February 2004. On the Web at
1535         <a href="" class="link" target="_new"></a>.</p>
1536<p class="bibliomixed" id="Saxon">[Saxon] SAXON The XSLT and XQuery Processor. On the Web
1537         at <a href="" class="link" target="_new"></a>.</p>
1538<p class="bibliomixed" id="Kay08">[Kay 2008]  Kay, Michael Y. 2008. Ten Reasons Why Saxon
1539         XQuery is Fast, IEEE Data Engineering Bulletin, December 2008.</p>
1540<p class="bibliomixed" id="AElfred">[Ælfred]  The Ælfred XML Parser. On the Web at
1541            <a href="" class="link" target="_new"></a>.</p>
1542<p class="bibliomixed" id="JNI">[Hitchens 2002] Hitchens, Ron. Java NIO. O'Reilly, 2002.</p>
1543<p class="bibliomixed" id="Expat">[Expat] The Expat XML Parser.
1544            <a href="" class="link" target="_new"></a>.</p>
1547<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em; font-style: italic">Balisage Series on Markup Technologies</h3></div>
1551<div id="balisage-footer"><h3 style="font-family: serif; margin:0.25em">
1552<i>Balisage:</i> <small>The Markup Conference</small>
Note: See TracBrowser for help on using the repository browser.