Skip to main content

JAXB 2.0 perfromance

2 replies [Last post]
quansheng
Offline
Joined: 2005-10-05
Points: 0

I did some JAXB2.0 performance testing. In my result, if there is a single namespace in a XML file. JAXB2.0 Performance (marshall/unmarshall) is better than that of JAXB1.0. If there are more than one namespace in a XML documents, then JAXB 2.0 performance is worse. The reason for that is that I can use below option:

jaxb-xjc.jar -runtime

to optimize different namespace to share same runtime lib. when I generate java bean from a XML schema with JAXB1.0.

JAXB2.0 removes the option -runtime and I don't have clue to optimize it.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09
Points: 0

In our results and the bindmark benchmark, JAXB 2.0 is substantially faster in marshalling than 1.0. The unmarshalling performance is around the same. But it sounds like you aren't observing the same behavior.

I'm curious about the details of the measurement you did.

quansheng
Offline
Joined: 2005-10-05
Points: 0

Below are some testing I did two months ago. The tested message is based on IFX & SOAP 1.1 schemas.

Single namespace: message only includes IFX
Multiple namespace: the message includes both SOAP envelope and IFX

Result:

Case ( run 1000 times) JAXB1.0(ms) JAXB2.0(ms)
File (single namespace)--> JAXB Object 2684 1502
DOM (single namespace)--> JAXB Object 972 921
String(single namespace) --> DOM --> JAXB Object 2954 1913
String(single namespace) --> JAXB Object (default JAXB parser) 1052 531
String(multiple namespace) --> JAXB Object (default JAXB parser)* 861 3275
String(single namespace) --> SAX(Javolution) --> JAXB Object 831 1001
String(multiple namespaces) --> SAX(Javolution) --> JAXB Object 861 3545
String (single namespace) --> SAX(Apache) --> JAXB Object 1122 1002
String (multiple namespaces) --> SAX(Apache) --> JAXB Object 1001 3154

Conclusion:

1. For single namespace, JAXB2.0 performance is 2 time faster than that of JAXB1.0
2. *For multiple namespace, e.g: two namespace (one for soap xml schema , another one for IFX), JAXB2.0 performance is ~4 time slower than that of JAXB1.0***

****

We use xjc option to optimize multiple namespace performance for JAXB1.0. Since JAXB2.0 remove impl.runtime package, there is no such option to be used for the optimization.

-use-runtime
: suppress the generation of the impl.runtime package and simply