Re: [Templates] processing template chunks in parallel

[prev] [thread] [next] [Date index for 2005/03/08]

From: Perrin Harkins
Subject: Re: [Templates] processing template chunks in parallel
Date: 04:11 on 08 Mar 2005
Cahill, Earl wrote:
>    1. TT parses the page and does all tags, except those containing a
>       priority
>    2. I get, say, an array ref of hash refs, corresponding to the tags
>       for an entire page (since priorities don't necessarily match
>       layout order),
>    3. my stuff handles the priorities and make the calls in parallel,
>       waiting for calls to finish appropriately
>    4. I pass the array ref back to TT for interpolation, with variables
>       set in my code available to TT

It would all be much simpler if step 1 was that your code looks at some 
kind of user preferences data to see what should be on the page, and TT 
didn't enter the picture until step 4. That would also let you build 
clean code for generating the content data, which could make smart use 
of caching for things like your "geo" data.  It would be an ordinary 
forking and IPC programming exercise.

> Likely 
> way ahead of me, but if I have ten tags that each take a second, I have 
> a ten second+ load time.  Do the same thing in parallel and I am around 
> a second.

You'd be very lucky if that turns out to be true, but it could be close 
if these tasks are mostly just waiting on I/O from some other source.

Incidentally, sites like my.yahoo.com do all of this ahead of time and 
just do includes of the cached content when you hit the server.  And 
my.yahoo.com makes heavy use of Perl.

- Perrin

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] processing template chunks in parallel
Perrin Harkins 04:11 on 08 Mar 2005

Re: [Templates] processing template chunks in parallel
Larry Leszczynski 17:07 on 08 Mar 2005

Generated at 21:07 on 16 Mar 2005 by mariachi v0.52