Any way to speed up JAXB Marshalling?

Is there a way to speed up the JAXB call Marshaller.marshal(Object, OutputStream)?

The project I'm working on uses JAXB to [un] marshal objects with a fairly large XML schema. It someJaxbMarshaller.marshal(results, out)takes 2 seconds to end a call . Everything else (JPA sampling, spatial filtering, quite a lot of other logic) takes only about 1 second. So using JAXB tripled the response time of my request. I cache JAXBContext and Marshaller objects to speed things up as far as I can. This is just the actual sort that slows me down. Any suggestions?

I am using JAXB 2.2.3u1 , bundled with JAX-WS 2.2.3 . The new versions seem to break up a few things, so we are locked in this version of JAXB (overriding the Java-enabled JAX-WS 2.2.5, which uses JAXB 2.2.4u1 - which we cannot use as it throws NullPointerExceptionat boot). We are also in JDK 1.3.0_30 , and this is done in Eclipse Indigo. I saw a suggestion to use Woodstox, but JAX-WS 2.2.3 already includes it. I tried replacing it with the latest version, but it slowed down, shrinking by ~ 0.2 seconds. Removing Woodstox was exactly the same as using the version included with JAX-WS.

A schema supporting sortable objects is 5 MB in size . The actual XML document generated by JAXB is 117 KB in size .

+5
source share

All Articles