You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alex Kotchnev <ak...@gmail.com> on 2008/08/13 23:04:53 UTC

Elimination of reflection in T5

The T5 main page (http://tapestry.apache.org/tapestry5/) indicates that
reflection is virtually eliminated , which contributes to the improved
performance of the framework.

Can anybody point me to some resource (maybe source code, forum post) or
give me a tip on how to see how this is done ? For example, if a component
in a template specifies <t:textoutput value="prop:foo" /> or something
similar, how is reflection avoided in resolving that the "getFoo" method
needs to be called on the underlying component class ?

Thanks,

Alex Kotchnev

Re: Elimination of reflection in T5

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Thu, Aug 14, 2008 at 12:16 PM, Christian Edward Gruber
<ch...@gmail.com> wrote:
> On 14-Aug-08, at 15:06 , Thiago H. de Paula Figueiredo wrote:
>>
>> I even started to play with Javassist, but unfortunately I had other
>> things to do at the time.
>> Almost all times I think of it I think of writing a Spring-esque
>> annotation-driven transaction management package for Tapestry-IoC . . .


Annotations: yes
Javassist?  No --> Use the AspectDecorator!

You get the power of Javassist without writing any Javassist (or using
ClassFab or any of that).

>
> Man, it's always a function of spare time.  There are so many things I want
> to write, but I have to wait until I'm angry enough at not having it, or
> some client needs the same thing...
>
> Christian.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by Christian Edward Gruber <ch...@gmail.com>.
On 14-Aug-08, at 15:06 , Thiago H. de Paula Figueiredo wrote:
>
> I even started to play with Javassist, but unfortunately I had other  
> things to do at the time.
> Almost all times I think of it I think of writing a Spring-esque  
> annotation-driven transaction management package for Tapestry- 
> IoC . . .

Man, it's always a function of spare time.  There are so many things I  
want to write, but I have to wait until I'm angry enough at not having  
it, or some client needs the same thing...

Christian.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 14 Aug 2008 15:54:36 -0300, Howard Lewis Ship <hl...@gmail.com>  
escreveu:

> Wait, Javassist has documentation now ? :-)

I was thinking specifically about this tutorial:  
http://www.csg.is.titech.ac.jp/~chiba/javassist/tutorial/tutorial2.html.  
;) :)

I even started to play with Javassist, but unfortunately I had other  
things to do at the time.
Almost all times I think of it I think of writing a Spring-esque  
annotation-driven transaction management package for Tapestry-IoC . . .

Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by Howard Lewis Ship <hl...@gmail.com>.
Wait, Javassist has documentation now ? :-)

The bytecode stuff has a number of advantages over reflection.  It's
2x to 5x faster (that number shifts with every JDK release).  It can
be inlined and optimized by Hotspot.  We don't waste time creating
Object[] arrays for parameters and boxing and unboxing primitives.

My attitude is that, for any particular method invocation, the
difference is minuscule; virtually undetectable.  However, multiplied
by the thousands of method invocations per request it might start to
be measurable.

Meanwhile, I'm looking, for 5.1, at ways to improve performance,
especially on IoC service proxies.

On Thu, Aug 14, 2008 at 9:14 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Em Wed, 13 Aug 2008 18:50:41 -0300, Bill Holloway <bi...@peoplepad.com>
> escreveu:
>
>> I think really that *runtime* reflection is eliminated.  I wonder if
>> the bytecode generation is really faster than reflection.  At any
>> rate, to accomplish elimination of runtime reflection isn't the
>> bytecode generation done at component creation time and the resulting
>> bytecodes then pooled?
>
> The bytecode generation is made once and used many times. It is only
> generated again if you change your page or component or mixin.
>
> By the way, the Javassist documentation is a nice reading. :)
>
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 13 Aug 2008 18:50:41 -0300, Bill Holloway <bi...@peoplepad.com>  
escreveu:

> I think really that *runtime* reflection is eliminated.  I wonder if
> the bytecode generation is really faster than reflection.  At any
> rate, to accomplish elimination of runtime reflection isn't the
> bytecode generation done at component creation time and the resulting
> bytecodes then pooled?

The bytecode generation is made once and used many times. It is only  
generated again if you change your page or component or mixin.

By the way, the Javassist documentation is a nice reading. :)

Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by Bill Holloway <bi...@peoplepad.com>.
I think really that *runtime* reflection is eliminated.  I wonder if
the bytecode generation is really faster than reflection.  At any
rate, to accomplish elimination of runtime reflection isn't the
bytecode generation done at component creation time and the resulting
bytecodes then pooled?

Bill

On Wed, Aug 13, 2008 at 4:18 PM, Davor Hrg <hr...@gmail.com> wrote:
> Javassist is used to generate
> bytecode on the fly.
>
> prop: is a binding like any other,
> look at the source of the
> org.apache.tapestry5.internal.bindings.PropBindingFactory
>
> which in effect uses
> PropertyConduitSourceImpl.create(targetClass, expression);
> ehere expression is "foo"
>
> Davor Hrg
>
>
> On Wed, Aug 13, 2008 at 11:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
>
>> The T5 main page (http://tapestry.apache.org/tapestry5/) indicates that
>> reflection is virtually eliminated , which contributes to the improved
>> performance of the framework.
>>
>> Can anybody point me to some resource (maybe source code, forum post) or
>> give me a tip on how to see how this is done ? For example, if a component
>> in a template specifies <t:textoutput value="prop:foo" /> or something
>> similar, how is reflection avoided in resolving that the "getFoo" method
>> needs to be called on the underlying component class ?
>>
>> Thanks,
>>
>> Alex Kotchnev
>>
>



-- 
Bill @ PeoplePad

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Elimination of reflection in T5

Posted by Davor Hrg <hr...@gmail.com>.
Javassist is used to generate
bytecode on the fly.

prop: is a binding like any other,
look at the source of the
org.apache.tapestry5.internal.bindings.PropBindingFactory

which in effect uses
PropertyConduitSourceImpl.create(targetClass, expression);
ehere expression is "foo"

Davor Hrg


On Wed, Aug 13, 2008 at 11:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:

> The T5 main page (http://tapestry.apache.org/tapestry5/) indicates that
> reflection is virtually eliminated , which contributes to the improved
> performance of the framework.
>
> Can anybody point me to some resource (maybe source code, forum post) or
> give me a tip on how to see how this is done ? For example, if a component
> in a template specifies <t:textoutput value="prop:foo" /> or something
> similar, how is reflection avoided in resolving that the "getFoo" method
> needs to be called on the underlying component class ?
>
> Thanks,
>
> Alex Kotchnev
>

Re: Elimination of reflection in T5

Posted by Howard Lewis Ship <hl...@gmail.com>.
Reflection is still used for analysis; there is no avoiding that.  But
once a page is instantiated, there is no further use of reflection.

On Wed, Aug 13, 2008 at 2:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
> The T5 main page (http://tapestry.apache.org/tapestry5/) indicates that
> reflection is virtually eliminated , which contributes to the improved
> performance of the framework.
>
> Can anybody point me to some resource (maybe source code, forum post) or
> give me a tip on how to see how this is done ? For example, if a component
> in a template specifies <t:textoutput value="prop:foo" /> or something
> similar, how is reflection avoided in resolving that the "getFoo" method
> needs to be called on the underlying component class ?
>
> Thanks,
>
> Alex Kotchnev
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org