Hi Lethal, Lethal Possum wrote:
> Hello Jörg, > > Thank you for your quick and clear answer. > > I am trying to migrate an existing code base from JAXB to XStream, to > compare the unmarshalling speed and the ease of use of both frameworks. Well, I guess JAXB will process the XML faster, just because it uses generated stubs to read/write the predefined XML. However, biggest drawback is, that you will have to generate different stubs for different versions of your schema and it gets even more difficult, if you have to process multiple XML versions of your schema without knowing which one in advance. Here you can provide custom converters in XStream that can read old and new format at the same time. > Currently our JAXB annotations use the accessors. I wanted to do the same > in XStream in case some of the accessors have some extra logic in it and > also to make the benchmark as fair as possible. > > I will review our accessors and if none of them do anything special, I > guess accessing the fields directly is not a big issue. One general advice: Instantiating an XStream instance and setting it up is a very expensive operation. Therefore you should do this only once and then reuse the prepared instance every time. You may use this instance even concurrently since marshalling/unmarshalling is threadsafe. If you have to optimize extremely for speed, you should create custom converters for your objects instead of using the default ones based on reflection. This will have a similar effect compared to the JAXB stubs. Cheers, Jörg --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email