Hi Dan!

Tks for your reply! The retention police of the annotations is
Runtime, because in need of the annotated values at runtime.
I can post the code, but it is far to long. I wrote an litle article
explaining why its used and my whole solution. Check it out if you
please.
It is originally writen in portuguese(brazil) but google should have
no problems translating it to english in case you want to check
anything further than the code (which is writen mainly in english
itself).

http://zbra.com.br/2011/07/06/androidksoap-pt-1-transcrevendo-soapobjects-atraves-de-annotations-reflection/

I will check the tool you pointed out.

Tks in advance,
Bruno

On Jul 7, 5:45 am, Daniel Drozdzewski <daniel.drozdzew...@gmail.com>
wrote:
> On Tue, Jul 5, 2011 at 9:06 PM, Bruno Vinicius
>
> <bruno.vinicius...@gmail.com> wrote:
> > Hi,
>
> > I've been using annotations on a Android project for a parsing XML
> > data into a VO object, and I came to notice that retrieving Annotation
> > info from a class or field is very slow. On a 1k iterations loop it
> > gives me a 100x fold performance drop vesus a specific parsing
> > algorithm version. Caching the annotation data on the first run, gave
> > me results very close (~10ms diference) on the specific algorithm
> > version.
>
> Bruno,
>
> any chance to see the code of all 3 versions (annotated, annotated &
> cached, and specific parsing) ?
> If the parsing is specific to your problem, then it is bound to be
> quicker, as otherwise you pay for universality.
>
> Annotations per se should not hit the performance, the same way that
> static class members or methods don't hit the performance.
> It is what happens to those annotations. They annotate various parts
> of your code, so that some processing based on that metadata can be
> done. They are essentially markers helping to find code, for whatever
> reason and whatever processing.
>
> They can be processed at compile time, which is probably what you
> should do with your parser, but it will depend on the parsing
> technology you use. How are the annotations that you use defined (each
> annotation has retention policy).
>
> Have a look at Annotation Processing Tool (apt), that comes with Java
> JDK 5. In JDK 6 it is a part of the compiler. It should help you
> generate the code at compile time, so you would not be hit by runtime
> reflection and introspecting.
>
> ...but it's all speculations as the problem of performance is quite
> complex and multi-layered as you can imagine
>
> The best solution to XML parsing is to use parsers that are geared
> towards mobile platforms.
>
> Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to