You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tobias Wehrum <Le...@dragonlab.de> on 2008/04/15 12:48:13 UTC

Calling functions at page template (in a grid) costs very much time

Hello,

in my template, I'm using a grid similar to this simplified model:

<t:grid source="gridObjects" row="currentGridObject" model="gridModel">
    <t:parameter name="someCell">
        ${someFunctionGeneratingSomething}
    </t:parameter>  
</t:grid>

When i comment out the parameter block, it is significantly faster 
compared to when getSomeFunctionGeneratingSomething() is called. (When 
it costs 2 seconds to show 4 gridObjects without someCell, it will cost 
4 seconds with it.)
At first I thought the database calls in 
getSomeFunctionGeneratingSomething() are consuming the time, but then I 
replaced it with a simple "return 0;" - and still it consumes almost 4 
seconds, the difference was minimal.

I "solved" the problem by constructing a class dedicated to presentate 
my gridObjects (simply wrapping them, so that all properties are copied 
and a property does what getSomeFunctionGeneratingSomething would be 
doing). That works, but it would be quite a bother to construct this for 
all classes I want to output; it would nearly double my work with them, 
not to mention the maintainability.

Why is this so time intensive? Is there any better way to solve this?

Thanks,
Tobias

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


Re: Calling functions at page template (in a grid) costs very much time

Posted by Howard Lewis Ship <hl...@gmail.com>.
Yep, nothing takes that long in Tapestry :-)

Seriously, the ${...} stuff is turned into pure method calls, no
reflection.  The only thing that can slow stuff down is database (or
equivalent out-of-process) access.

On Tue, Apr 15, 2008 at 5:30 AM, Filip S. Adamsen <fs...@fsadev.com> wrote:
> Hi Tobias,
>
>  Something is definitely wrong here. Can you share some more code with us?
>
>  -Filip
>
>  Tobias Wehrum skrev:
>
>
>
> > Hello,
> >
> > in my template, I'm using a grid similar to this simplified model:
> >
> > <t:grid source="gridObjects" row="currentGridObject" model="gridModel">
> >   <t:parameter name="someCell">
> >       ${someFunctionGeneratingSomething}
> >   </t:parameter>  </t:grid>
> >
> > When i comment out the parameter block, it is significantly faster
> compared to when getSomeFunctionGeneratingSomething() is called. (When it
> costs 2 seconds to show 4 gridObjects without someCell, it will cost 4
> seconds with it.)
> > At first I thought the database calls in
> getSomeFunctionGeneratingSomething() are consuming the time, but then I
> replaced it with a simple "return 0;" - and still it consumes almost 4
> seconds, the difference was minimal.
> >
> > I "solved" the problem by constructing a class dedicated to presentate my
> gridObjects (simply wrapping them, so that all properties are copied and a
> property does what getSomeFunctionGeneratingSomething would be doing). That
> works, but it would be quite a bother to construct this for all classes I
> want to output; it would nearly double my work with them, not to mention the
> maintainability.
> >
> > Why is this so time intensive? Is there any better way to solve this?
> >
> > Thanks,
> > Tobias
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>  ---------------------------------------------------------------------
>  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: Calling functions at page template (in a grid) costs very much time

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Tobias,

Something is definitely wrong here. Can you share some more code with us?

-Filip

Tobias Wehrum skrev:
> Hello,
> 
> in my template, I'm using a grid similar to this simplified model:
> 
> <t:grid source="gridObjects" row="currentGridObject" model="gridModel">
>    <t:parameter name="someCell">
>        ${someFunctionGeneratingSomething}
>    </t:parameter>  </t:grid>
> 
> When i comment out the parameter block, it is significantly faster 
> compared to when getSomeFunctionGeneratingSomething() is called. (When 
> it costs 2 seconds to show 4 gridObjects without someCell, it will cost 
> 4 seconds with it.)
> At first I thought the database calls in 
> getSomeFunctionGeneratingSomething() are consuming the time, but then I 
> replaced it with a simple "return 0;" - and still it consumes almost 4 
> seconds, the difference was minimal.
> 
> I "solved" the problem by constructing a class dedicated to presentate 
> my gridObjects (simply wrapping them, so that all properties are copied 
> and a property does what getSomeFunctionGeneratingSomething would be 
> doing). That works, but it would be quite a bother to construct this for 
> all classes I want to output; it would nearly double my work with them, 
> not to mention the maintainability.
> 
> Why is this so time intensive? Is there any better way to solve this?
> 
> Thanks,
> Tobias
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

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


T5: Calling functions at page template (in a grid) costs very much time

Posted by Tobias Wehrum <Le...@dragonlab.de>.
Sorry, I forgot: Tapestry 5.

Tobias Wehrum schrieb:
> Hello,
>
> in my template, I'm using a grid similar to this simplified model:
>
> <t:grid source="gridObjects" row="currentGridObject" model="gridModel">
>    <t:parameter name="someCell">
>        ${someFunctionGeneratingSomething}
>    </t:parameter>  </t:grid>
>
> When i comment out the parameter block, it is significantly faster 
> compared to when getSomeFunctionGeneratingSomething() is called. (When 
> it costs 2 seconds to show 4 gridObjects without someCell, it will 
> cost 4 seconds with it.)
> At first I thought the database calls in 
> getSomeFunctionGeneratingSomething() are consuming the time, but then 
> I replaced it with a simple "return 0;" - and still it consumes almost 
> 4 seconds, the difference was minimal.
>
> I "solved" the problem by constructing a class dedicated to presentate 
> my gridObjects (simply wrapping them, so that all properties are 
> copied and a property does what getSomeFunctionGeneratingSomething 
> would be doing). That works, but it would be quite a bother to 
> construct this for all classes I want to output; it would nearly 
> double my work with them, not to mention the maintainability.
>
> Why is this so time intensive? Is there any better way to solve this?
>
> Thanks,
> Tobias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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