Sure, I will find the code again and post it somewhere. It is just a bunch of 
prototype code, but here is the gist:

I search all of the classes and I find all matching metadata, for example 
properties noted with [Inject]. I build a small class that has a reference to 
each of these classes, along with the list of properties and, for my particular 
use case, some information about types and constructor arguments. Then I wrap 
that with an API that allows it to be queried.

It does carry some overhead in a variety of ways but a lot of it just ends up 
being references to the constant pool. Since I reference that class early, it 
forces everything else to be touched, etc., however, subsequent looks ups don't 
require a describeType and are very fast. I was trying to make dependency 
injection much faster and I was limiting the metadata to injection points. I am 
not saying we would want to map every piece of metadata in the system this way.

In either case, it sped the DI process up a whole lot as I knew what was 
required of the constructor and any fields ahead of time and I could do fully 
recursive introspected injection with a minimal performance hit.

Mike

-----Original Message-----
From: omup...@gmail.com [mailto:omup...@gmail.com] On Behalf Of Om
Sent: Tuesday, January 24, 2012 5:54 PM
To: flex-dev@incubator.apache.org
Subject: Re: metadata

Bumping this thread.

Michael, your note about post-processing metadata into an actionscript class 
and hence speeding things up without having to use describeType() sounds very 
interesting.  Can you please post more info?

I always wondered about how using descriptType() affects performance.  Your 
results could be enlightening.  If we really get such a good performance boost, 
I am all for adding this as a feature in our new Apache Flex.

Thanks,
Om

On Sun, Jan 22, 2012 at 11:10 PM, Bogdan DINU <flex.programm...@gmail.com>wrote:

> Hi Michael,
>
> would you care to share a link of your experiment sources? :) We might 
> all learn something from it.
>
> Thanks in advance!
>
> Best regards,
> Bogdan
>
> On Sun, Jan 22, 2012 at 10:00 PM, Michael A. Labriola < 
> labri...@digitalprimates.net> wrote:
>
> > I did some experiments a while back where I post-processed metadata 
> > into
> a
> > ActionScript class and then included it in compilation. Basically, I 
> > had
> a
> > class that referenced all places a given metadata tag was being used
> (like
> > for injection points). Versus using describeType, I could speed up 
> > things like robot legs nearly 10 fold.
> >
> > Mike
> >
> >
> > -----Original Message-----
> > From: Michael A. Labriola [mailto:labri...@digitalprimates.net]
> > Sent: Sunday, January 22, 2012 1:58 PM
> > To: flex-dev@incubator.apache.org
> > Subject: RE: metadata
> >
> > There was a compiler change a while back. Basically, if a library 
> > forces
> a
> > given piece of metadata to be kept, then that setting is inherited 
> > by the project. So, when flexunit forces [Test] to be kept in the 
> > library, all projects that include flexunit's swc get that setting
> >
> > -----Original Message-----
> > From: Michael Schmalle [mailto:m...@teotigraphix.com]
> > Sent: Saturday, January 21, 2012 5:21 AM
> > To: flex-dev@incubator.apache.org
> > Subject: Re: metadata
> >
> > Quoting Martin Heidegger <m...@leichtgewicht.at>:
> >
> > > @Michael: Wasn't there some kind of compiler change regarding this?
> > > I can't properly recall it.
> > >
> > > However: As far as I know: the standard meta tags (like bindable) 
> > > do get compiled into the code and are readable with describeType. 
> > > swfs are readable like external files with the proper tools, which 
> > > is why swc inspection works in FlexBuilder, FDT, etc. If you put 
> > > them in an external file you'd make it easier to tamper and break running 
> > > code.
> > >
> > > yours
> > > Martin.
> > >
> >
> > The Bindable etc, are included in the main build.
> >
> > whiteboard/frameworks/build_framework.xml
> >
> > In the core, framework and mx targets.
> >
> > <compc ...
> >    <keep-as3-metadata name="Bindable"/>
> >    <keep-as3-metadata name="Managed"/>
> >    <keep-as3-metadata name="ChangeEvent"/>
> >    <keep-as3-metadata name="NonCommittingChangeEvent"/>
> >    <keep-as3-metadata name="Transient"/> </compc>
> >
> >
> > As far as the compiler change, I don't know.
> >
> > Mike
> >
> > Notice: This transmission is intended only for the use of the 
> > individual or entity to which it is addressed and may contain 
> > information that is privileged or confidential. Any dissemination, 
> > distribution or copying of this transmission by anyone other than 
> > the intended recipient is strictly prohibited. If you have received 
> > this transmission in error, please
> notify
> > the sender immediately by e-mail or telephone and delete the 
> > original transmission. Thank you.
> >
>
>
>
> --
> http://www.badu.ro
>

Reply via email to