You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Praveen Ray <pr...@yahoo.com> on 2005/08/18 05:17:33 UTC

Clearsilver Templates

Hi
Does anyone have any experience of using clearsilver
(http://www.clearsilver.net) with mod_perl (1 or 2)?
Any comparisons of this with Template-Toolkit? The
Template-Toolkit is getting rather slow for our needs and
I'm looking around for alternatives.
thanks

  - Praveen  

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Clearsilver Templates

Posted by jonathan vanasco <jv...@mastersofbranding.com>.
On Aug 18, 2005, at 1:10 AM, Perrin Harkins wrote:

> Praveen Ray wrote:
>> Does anyone have any experience of using clearsilver
>> (http://www.clearsilver.net) with mod_perl (1 or 2)?

I don't have any experience under mod_perl - but if you want a better  
idea of how the system works than what is on the site, i'd suggest  
going through the Trac svn repository browser/ticketing system --  
it's all done in clearsilver templates via python.

i've always found looking at functional implementations of templating  
systems easier to understand than the documentation

Re: Clearsilver Templates

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2005-08-18 at 08:39 -0700, Praveen Ray wrote:
> I suspect its because we've written a large number of
> moderately complex macros

Could be.  You can probably test this fairly simply by globally removing
the macro calls and benchmarking.

> Or, is it the fact that TT uses string concatenation for
> every MACRO and BLOCK's output?

Not likely, although that may increase the memory used.

> I wish TT could write onto output stream as the output is
> generated instead of first building a giant string.

There have been patches on the list to flush output periodically, but I
don't think they remove all buffering.  The buffering is what makes
things like filters, wrappers, and exception handling possible.

However, TT is pretty hackable if you want to change that.

- Perrin


Re: Clearsilver Templates

Posted by Praveen Ray <pr...@yahoo.com>.
> > The
> > Template-Toolkit is getting rather slow for our needs
> and
> > I'm looking around for alternatives.
> 
> That's pretty surprising.  Pure template processing is
> your bottleneck? 
>   Are you doing some kind of data processing or data
> retrieval from 
> inside of your templates?

I suspect its because we've written a large number of
moderately complex macros to hide common HTML
structures..eg
an L_SELECT macro to draw <select> box , L_TABLE to draw
moderately complex tables.
All these macros end up taking bunch of parameters 
in order to customize the behaviour. And, we must run thru
lots of IF, ELSE checks inside macros depending upon what
is passed..probably that takes a lot of time.
Or, is it the fact that TT uses string concatenation for
every MACRO and BLOCK's output?
I wish TT could write onto output stream as the output is
generated instead of first building a giant string.

  - Praveen  


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

Re: Clearsilver Templates

Posted by Perrin Harkins <pe...@elem.com>.
Praveen Ray wrote:
> Does anyone have any experience of using clearsilver
> (http://www.clearsilver.net) with mod_perl (1 or 2)?

I remember talking to the author at one point.

> Any comparisons of this with Template-Toolkit?

It will be less flexible (no simple handling of objects or complex 
structures without rearranging them for the template), have fewer bells 
and whistles (no wrappers, no plugins), and will not be possible to 
extend with Perl.  In exchange, it might be faster, might use less 
memory, and will be able to use the same templates from C code.  Yahoo 
liked it because they could load a bunch of data from C (e.g. XS code 
called from perl) without needing to turn it into perl data structures.

> The
> Template-Toolkit is getting rather slow for our needs and
> I'm looking around for alternatives.

That's pretty surprising.  Pure template processing is your bottleneck? 
  Are you doing some kind of data processing or data retrieval from 
inside of your templates?

A very fast templating tool for Perl, suitable for people who don't need 
much beyond the basics, is HTML::Template::JIT.  It compiles templates 
into small C libraries.

- Perrin