You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Geir Magnusson Jr." <ge...@adeptra.com> on 2002/12/10 10:44:40 UTC
Re: that statement takes 20s !!!!
On Tuesday, December 10, 2002, at 02:37 AM, IO wrote:
>
>
>
> Hello Everybody,
>
> I am using Velocity in a servlet web application that keeps
> it's VTL code in a database. I am using the following code to
> process the template:
>
> Velocity.evaluate(context, writer, "label1", vtlCode);
We do have a data source loader if you wanted to do things the
'conventional' way.
>
> where vtlCode is a String object containing the VTL code :)).
>
> My problem is that only that statement takes 20s !!!! Is there an
> workaround for this ?
>
Do you mean executing that evaluate takes 20 seconds?
> The VM template has only a for..each directive and in the context
> I have 20 objects, each of these has references to aprox
> 10 other objects.
>
> I am using Velocity 1.3c2, Resin 2.0.3, JDK 1.4.
>
Could you describe the template (send it to the list) and what the
objects are, and what they do?
--
Geir Magnusson Jr 203-355-2219(w)
Adeptra, Inc. 203-247-1713(m)
geirm@adeptra.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: that statement takes 20s !!!!
Posted by Attila Szegedi <sz...@freemail.hu>.
As usual, the wisdom is: don't speculate, profile. Either learn how to use
the -Xrunhprof java command-line argument, or try to use some graphical
profiler (they're mostly sold for a fee, but you can download them for a
30-day evaluation). You should see exactly what methods take most of the
time in your app.
Cheers,
Attila.
--
Attila Szegedi
home: http://www.szegedi.org
----- Original Message -----
From: "Cocosila" <co...@home.ro>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: 2002. december 11. 13:32
Subject: Re: that statement takes 20s !!!!
> Hello,
>
>
> Sorry for the delay. Here are the information about the case:
>
> * the template is in the attachment
>
> * about the objects, there are 20 simple data containers in $list.
> Each of these containers have references to other containers like
> objects (Characteristics, Classification).
>
> * and YES only that evaluate takes 20s !! I calculate like this:
>
> start = System.currentTimeMillis();
> Velocity.evaluate(context, outWriter,
> page + "-DB VM-", vtlCode);
> stop = System.currentTimeMillis();
> logger.debug("Time for evaluating the " + page + " VTL code: "
> + (stop - start));
>
> All suggestions are welcome !
>
> Best regards,
> Dan
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: that statement takes 20s !!!!
Posted by Ch...@dlr.de.
Hi,
since velocity has performed *very* fast for so many users that
have stated this to the list, I suspect that the CPU time is swalloed
somewhere else. Please check and try the following:
* Procoess memory consumption - if the Java VM gets to the
permitted heap space (-mX command line argument) it will
start the GC and slow down.
* Add a tool to the context and test the $mainContainer calls,
I suspect that somewhere in your code it may chew up the time:
<!-- start $timetool.init() -->## set the timer to current time
...
<!-- Time at step0=$timetool.test() -->
$mainContainer
<!-- Time at step1=$timetool.test() -->
...
Cocosila wrote:
> Hello,
>
>
> Sorry for the delay. Here are the information about the case:
>
> * the template is in the attachment
>
> * about the objects, there are 20 simple data containers in $list.
> Each of these containers have references to other containers like
> objects (Characteristics, Classification).
>
> * and YES only that evaluate takes 20s !! I calculate like this:
>
> start = System.currentTimeMillis();
> Velocity.evaluate(context, outWriter,
> page + "-DB VM-", vtlCode);
> stop = System.currentTimeMillis();
> logger.debug("Time for evaluating the " + page + " VTL code: "
> + (stop - start));
>
> All suggestions are welcome !
>
> Best regards,
> Dan
>
>
> ------------------------------------------------------------------------
>
> #macro( nextColor $classe )
> #if( $classe == "fond" )
> #set( $classe = "fond3" )
> #else
> #set( $classe = "fond" )
> #end
> #end
> <html>
>
> <head></head>
>
> <body>
>
>
>
> <table width="80%" border="0" align="center" cellpadding="0" cellspacing="1">
>
>
> #set( $classe = "fond3" )
>
> #foreach( $mainContainer in $list)
> #nextColor($classe)
> <tr class="$classe">
> <td width="80" align="center" valign="middle">
> #set( $nbStars = [$mainContainer.getCharacteristics().getClassification().getValue()..1] )
> #foreach( $star in $nbStars )
> <img src="/look/$partner/images/star.gif">
> #end
> </td>
> <td>
> <b>
> <a class="lien"
> href="/servlets/contexthandling?pg=2&house=$mainContainer.getCharacteristics().getId()&postfix=Ehr">
> $mainContainer.getReception()
> </a>
> </b>
> </br>
> <b class="texteP">$mainContainer.getCity()</b>
> </td>
> <td width="70" align="center" nowrap>
> <span class="colorP">
> $mainContainer.getCharacteristics().getLowPrice()
> $mainContainer.getCurrencyCode()
> </span>
> </td>
> </tr>
> <tr>
> <td colspan="3" class="fond">
> <IMG src="/look/$partner/images/pxtransparent.gif" width="1" height="1">
> </td>
> </tr>
> #end
>
> </table>
>
>
>
> </body>
> </html
>
>>
>>------------------------------------------------------------------------
>>
>>--
>>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
--
:) Christoph Reck
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: that statement takes 20s !!!!
Posted by Cocosila <co...@home.ro>.
Hello,
Sorry for the delay. Here are the information about the case:
* the template is in the attachment
* about the objects, there are 20 simple data containers in $list.
Each of these containers have references to other containers like
objects (Characteristics, Classification).
* and YES only that evaluate takes 20s !! I calculate like this:
start = System.currentTimeMillis();
Velocity.evaluate(context, outWriter,
page + "-DB VM-", vtlCode);
stop = System.currentTimeMillis();
logger.debug("Time for evaluating the " + page + " VTL code: "
+ (stop - start));
All suggestions are welcome !
Best regards,
Dan