<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
first stax performance test
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/alex.loubyansky%40jboss.com">Alexey Loubyansky</a> in <i>JBoss XML Binding Development</i> - <a href="http://community.jboss.org/message/541766#541766">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I've written a simple StAX-based parser for XB to see how it affects the performance. I've used the same tests I've been using previously while working on optimizations and comparison to JAXB.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I'd like to mention that XB testsuite with StAX parser has a few failures related to required attributes with default values and tests related to XInclude. In JBoss AS both of these are important.</p><p>As to the default attributes, if they are missing from the xml, the parser is supposed to silently add them in. But this happens (with SAX at least) only if the validation is enabled. The StAX impl I've used for testing (which is included in JDK6) doesn't seem to support validation (setting isValidating proprty to true fails).</p><p>XInclude is not supported. But if necessary, I guess, we implement it on top.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The results show the average time (in ms) of 10 independent re-runs and include the time for the first test run (includes parser initialization, classloading, etc) and subsequent 1000 runs.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>XB with SAX (custom written handlers, XInclude disabled, property replacement disabled, non-validating)</p><p>first run: 127.1</p><p>next 1000 runs: 892.4</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>XB with SAX (default handlers, XInclude disabled, property  replacement disabled, non-validating)</p><p>first run: 127.8</p><p>next  1000 runs: 997</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>JAXB (XInclude disabled, non-validating)</p><p>first run: 119.8</p><p>next 1000 runs: 1088.4</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>XB with StAX (custom written handlers, property replacement  disabled)</p><p>first run: 22.6</p><p>next 1000 runs: 1015.3</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>XB with StAX (default reflection-based handlers, property replacement disabled)</p><p>first run: 24.8</p><p>next 1000 runs: 1102.1</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The initialization with StAX is unbeatable. But then actually parsing and unmarshalling isn't showing that well. Just to be clear, what I did is just switched from SAX events to StAX, the parser looks very simple (create stream and pull events), I don't see potentially significant optimizations there.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/541766#541766">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss XML Binding Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2065">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>