Any Way to Speed Up JAXB Marshalling?

QlimaxPovar

New Member
Is there any way to speed up a call to the JAXB \[code\]Marshaller.marshal(Object, OutputStream)\[/code\]?The project I'm working on is using JAXB to [un]marshal objects with a fairly large XML schema. The call \[code\]someJaxbMarshaller.marshal(results, out)\[/code\] takes 2 seconds to complete. Everything else (JPA fetching, spatial filtering, quite a bit of other logic) takes only about 1 second. So the use of JAXB is tripling my request response time. I'm caching the JAXBContext and Marshaller objects, to speed things up as much as I can. It's only the actual marshalling that is slowing me down. Any suggestions?I'm using JAXB 2.2.3u1, bundled with JAX-WS 2.2.3. Newer versions seem to break multiple things, so we're locked into that version of JAXB (overriding the Java-included JAX-WS 2.2.5 which uses JAXB 2.2.4u1 - which we can't use, as it throws a \[code\]NullPointerException\[/code\] on load). We're also on JDK 1.3.0_30, and this is being run in Eclipse Indigo. I saw a suggestion to use Woodstox, but JAX-WS 2.2.3 already includes it. I tried swapping it out with the newest version, but that slowed down marshalling by ~0.2 seconds. Removing Woodstox had exactly the same performance as using the version included with JAX-WS.The schema backing the objects being marshalled is about 5 MB in size. The actual XML document that JAXB generates is 117 KB in size.
 
Back
Top