You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "White, Tim" <Ti...@qwest.com> on 2004/02/05 18:17:28 UTC

"Compiling" Velocity?

Hi -

 I've worked with template engines in other languages (such as Smarty in
PHP), that "compile" the template.  Similar to the way that JSP compiles
into a servlet.

 Can anyone help me understand if this would be useful to velocity from
a performance perspective?

 IIRC, velocity keeps the parsed version of the template around, is this
equivalent to compiling it?

Thanks!

Tim White

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: "Compiling" Velocity?

Posted by Mike Curwen <gb...@gb-im.com>.
> -----Original Message-----
> From: Geir Magnusson Jr [mailto:geir@4quarters.com] 
> Sent: Saturday, February 07, 2004 9:11 AM
> To: Velocity Users List
> Subject: Re: "Compiling" Velocity?
> 
> 
> 
> >
> > I had a set of pages that I used to administer a database of 
> > users/passwords/permissions.  The original set of pages was 
> Velocity 
> > templates and servlets.
> >
> > Keeping the servlets essentially the same, I replaced the Velocity 
> > templates with JSP.  Page response times tripled.
> 
> Why did you replace them?
> 

It occurred to me that someone else at my job might want to support the
pages. Unfortunately, model-1 seems to be the way things go around here,
because it needs to be done quickly, not correctly.  So by doing
servlets plus Velocity was taking it two steps beyond what anyone else
was 'used to'.  By bringing it back to servlets plus JSP, at least 1/2
of it was now familiar.  I'm trying to get the baby-steps (in the right
direction) kick-started here, and perhaps a different view layer was too
much to try, all at once.


> >
> > I don't have the hard stats, but there's one man's experience.
> >
> > Has anyone actually done a for-real 'load test' comparing JSP and 
> > Velocity as the view-layer on the same set of servlets ?
> 
> We used to beat JSPs pretty handily, but I think improvements in 
> jasper, the JSP compiler used by tomcat et al, now JSPs have been 
> reported to be faster.  We'll fix that :)
> 

This was on Tomcat 4.1.27, are you meaning 5.x ?



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: "Compiling" Velocity?

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Feb 6, 2004, at 2:59 PM, Mike Curwen wrote:

> the other thing to note, is that Velocity templates beat the pants of 
> of
> JSP pages anyways, in terms of speed.  My own story is highly
> un-scientific and anecdotal...

And given that Velocity was written primarily by people not wearing 
pants, we want the JSP pages to not have pants either.

>
> I had a set of pages that I used to administer a database of
> users/passwords/permissions.  The original set of pages was Velocity
> templates and servlets.
>
> Keeping the servlets essentially the same, I replaced the Velocity
> templates with JSP.  Page response times tripled.

Why did you replace them?

>
> I don't have the hard stats, but there's one man's experience.
>
> Has anyone actually done a for-real 'load test' comparing JSP and
> Velocity as the view-layer on the same set of servlets ?

We used to beat JSPs pretty handily, but I think improvements in 
jasper, the JSP compiler used by tomcat et al, now JSPs have been 
reported to be faster.  We'll fix that :)

It would be nice to put together a perf test suite...

geir

>
>
>
>> -----Original Message-----
>> From: Geir Magnusson Jr [mailto:geir@4quarters.com]
>> Sent: Friday, February 06, 2004 1:50 PM
>> To: Velocity Users List
>> Subject: Re: "Compiling" Velocity?
>>
>>
>>
>> On Feb 5, 2004, at 12:17 PM, White, Tim wrote:
>>
>>> Hi -
>>>
>>>  I've worked with template engines in other languages (such
>> as Smarty
>>> in
>>> PHP), that "compile" the template.  Similar to the way that JSP
>>> compiles
>>> into a servlet.
>>>
>>>  Can anyone help me understand if this would be useful to velocity
>>> from a performance perspective?
>>
>> We don't think so.  Velocity parses the template into an
>> object graph,
>> and execution after that is simply method calls on objects that are
>> held as references by other objects.  IOW, it's quick.
>>
>> I do have some ideas for performance, but they'll have to wait until
>> after the upcoming release flurry.
>>
>>>
>>>  IIRC, velocity keeps the parsed version of the template around, is
>>> this
>>> equivalent to compiling it?
>>
>> Pretty much.  There are improvements that can be made, but as with
>> everything, there will be tradeoffs.
>>
>> geir
>>
>>>
>>> Thanks!
>>>
>>> Tim White
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>> velocity-user-help@jakarta.apache.org
>>>
>>>
>> -- 
>> Geir Magnusson Jr                                   203-247-1713(m)
>> geir@4quarters.com
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: "Compiling" Velocity?

Posted by Mike Curwen <gb...@gb-im.com>.
the other thing to note, is that Velocity templates beat the pants of of
JSP pages anyways, in terms of speed.  My own story is highly
un-scientific and anecdotal...
 
I had a set of pages that I used to administer a database of
users/passwords/permissions.  The original set of pages was Velocity
templates and servlets.
 
Keeping the servlets essentially the same, I replaced the Velocity
templates with JSP.  Page response times tripled.
 
I don't have the hard stats, but there's one man's experience.

Has anyone actually done a for-real 'load test' comparing JSP and
Velocity as the view-layer on the same set of servlets ?
 


> -----Original Message-----
> From: Geir Magnusson Jr [mailto:geir@4quarters.com] 
> Sent: Friday, February 06, 2004 1:50 PM
> To: Velocity Users List
> Subject: Re: "Compiling" Velocity?
> 
> 
> 
> On Feb 5, 2004, at 12:17 PM, White, Tim wrote:
> 
> > Hi -
> >
> >  I've worked with template engines in other languages (such 
> as Smarty
> > in
> > PHP), that "compile" the template.  Similar to the way that JSP 
> > compiles
> > into a servlet.
> >
> >  Can anyone help me understand if this would be useful to velocity 
> > from a performance perspective?
> 
> We don't think so.  Velocity parses the template into an 
> object graph, 
> and execution after that is simply method calls on objects that are 
> held as references by other objects.  IOW, it's quick.
> 
> I do have some ideas for performance, but they'll have to wait until 
> after the upcoming release flurry.
> 
> >
> >  IIRC, velocity keeps the parsed version of the template around, is
> > this
> > equivalent to compiling it?
> 
> Pretty much.  There are improvements that can be made, but as with 
> everything, there will be tradeoffs.
> 
> geir
> 
> >
> > Thanks!
> >
> > Tim White
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> velocity-user-help@jakarta.apache.org
> >
> >
> -- 
> Geir Magnusson Jr                                   203-247-1713(m)
> geir@4quarters.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: "Compiling" Velocity?

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Feb 5, 2004, at 12:17 PM, White, Tim wrote:

> Hi -
>
>  I've worked with template engines in other languages (such as Smarty 
> in
> PHP), that "compile" the template.  Similar to the way that JSP 
> compiles
> into a servlet.
>
>  Can anyone help me understand if this would be useful to velocity from
> a performance perspective?

We don't think so.  Velocity parses the template into an object graph, 
and execution after that is simply method calls on objects that are 
held as references by other objects.  IOW, it's quick.

I do have some ideas for performance, but they'll have to wait until 
after the upcoming release flurry.

>
>  IIRC, velocity keeps the parsed version of the template around, is 
> this
> equivalent to compiling it?

Pretty much.  There are improvements that can be made, but as with 
everything, there will be tradeoffs.

geir

>
> Thanks!
>
> Tim White
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org