Hi Jairo,

Jairo de Almeida wrote:

> Hi using this source to test a converter http://pastebin.com/HU8JessQ
> Im have the log information about this test
> 02-05 20:47:14.375: I/TEST(421): Convertendo de list para xml levou :
> 59.97 segundos
> 02-05 20:51:37.297: I/TEST(421): Convertendo de xml para list levou :
> 262.913 segundos
> 02-05 20:51:37.297: I/TEST(421): tamanho do list :300
> 
> Convertendo de list para xml levou : 59.97 segundos = Time to convert
> from list to xml in seconds
> Convertendo de xml para list levou : 262.913 segundos = Time to
> convert from xml to list in seconds
> 
> Im have two performances to marshalling and unmarshalling my Objects
> using annotations
> My converter method is:
> 
> @Override
> public String toXML(Object value){
> XStream stream = getInstanceXStream(Converter.TYPE_SYNCRONIZE_DEVICE);
> stream.processAnnotations(new
> Class[]{UsuarioCollection.class,Usuario.class}); return
> stream.toXML(value); }
> 
> i'm instantiate the object xtream this way:
> 
> XStream stream = new XStream(new DomDriver()) {
>             protected MapperWrapper wrapMapper(MapperWrapper next) {
>                 return new MapperWrapper(next) {
>                     public boolean shouldSerializeMember(Class
> definedIn, String fieldName) {
>                         try {
>                         return definedIn != Object.class ||
> realClass(fieldName) != null;
>                         } catch(CannotResolveClassException cnrce) {
>                             return false;
>                         }
>                     }
>                 };
>             }
>         };
> return stream;
> 
> I can reduce the time  262.913 seconds of the conversion of xml to
> list using processAnnotations?

It should be faster, but I don't think it is measurable. However, DomDriver 
is a real poor choice when you're optimizing performance. AFAICS on Android 
XStream should select automatically the provided XPP implementation. And 
remember that performance optimization is always an individual setup for 
your special use case and that can not necessarily be generalized. See 
http://xstream.codehaus.org/parser-benchmarks.html

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to