-
Notifications
You must be signed in to change notification settings - Fork 47
Benchmark
To get an idea of how StAXON performs compared to alternatives, I did a simple performance test using the JUnitBenchmarks code benchmarking tool. The test compares reading and writing documents with
- XML StAX (implementation shipped with JDK 1.6)
- StAXON 0.5.0 (with Jackson 1.8.5 behind)
- Jettison 1.3 (another XML/JSON mapper)
The test document corresponds to a perfect binary tree of height 15 (with 216 - 1 nodes):
<alice xmlns="http://foo">
<bob david="edgar>
<bob david="edgar>
...
</bob>
<bob david="charlie>
...
</bob>
</bob>
<bob david="charlie>
<bob david="edgar>
...
</bob>
<bob david="charlie>
...
</bob>
</bob>
</alice>
or
{
"alice" : {
"@xmlns" : "http://foo",
"bob" : [ {
"@david" : "edgar",
"bob" : [ {
"@david" : "edgar",
...
}, {
"@david" : "charlie",
...
} ]
}, {
"@david" : "charlie",
"bob" : [ {
"@david" : "edgar",
...
}, {
"@david" : "charlie",
...
} ]
} ]
}
}
respectively.
Some notes:
-
The Write column refers to pure streaming mode, without caching events to determine array boundaries. This mode is not available with Jettison. With StAXON, array starts can still be triggered using the
<? xml-multiple ... ?>
processing instruction. -
The Write[] column refers to writing mode with automatically determining JSON array boundaries. As there's no such concept like arrays in XML, this is available only when writing to JSON. This is enabled in StAXON by setting the
PROP_AUTO_ARRAY
property onJsonXMLOutputFactory
totrue
. -
Each test has been run 10 times: 5 rounds to warm-up and another 5 to take the average time from. Time spent with garbage collection is automatically excluded by the benchmark tool.
-
The Jettison category was recorded using the Badgerfish mapping convention.
View the Benchmark Test source.