← Back to team overview

launchpad-dev team mailing list archive

Re: Rendering templates either server or client-side

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11-10-17 01:55 PM, Robert Collins wrote:
> This is pretty cool. I a question to help me (and perhaps others) 
> choose when to use *stache templates:
> 
> - how does the server side generation compare to TAL performance?
> We have pages that spend extraordinary amounts of time in TAL (and 
> have/are trying things like new TAL engines to improve on this).

It's hard to do a fair comparison.  I'm rendering the Mustache
template using the IJSONRequestCache data (which is the same as we'd
use on the client side).  If you look purely at time-to-render, it's
not fair to include the IJSONRequestCache retrieval and Mustache is
slower.  But if you assume that we are going to want to populate the
IJSONRequestCache anyway, then Mustache wins because it doesn't need
to re-retrieve the data.  However, that's due to the way we're using
TAL, and I believe we could use our Mustache strategy with TAL, i.e.
use the IJSONRequestCache as TAL's data source.

Also, Mustache template uses our new design, so the HTML is not
identical to the TAL.

Here are the times for retrieving 100 requests sequentially using wget:

TAL with populated IJSONRequestCache:
real	0m26.908s
user	0m1.256s
sys	0m0.524s

variation: ~300 ms

TAL with no IJSONRequestCache:
real	0m22.481s
user	0m1.224s
sys	0m0.760s

variation: ~500 ms

Mustache (using IJSONRequestCache):

real	0m25.917s
user	0m1.208s
sys	0m0.772s

variation: ~700 ms

Of course, technically, we could skip the server-side rendering :-)

real	0m25.639s
user	0m1.232s
sys	0m0.660s

I don't see great risk with using Mustache, but we should always test
performance when we make big changes to the way a page is rendered.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6lgGgACgkQ0F+nu1YWqI39zACfTDPmnjNGA2ae+jNLvDUPesSw
ytAAn2D7/y0B3kKbMmU1wMOwABBo3vn/
=fYst
-----END PGP SIGNATURE-----


References