The time taken to parse a template:

   albatross.Template(ctx, '<template>', text)

was compared with the time taken to unpickle a template:


cPickle.loads was about 3-6x faster. Template parsing took about 1ms per 1kB of template (3.2GHz P4). HOWEVER - apps deployed via persistent means such as FastCGI or mod_python will only load/parse a given template once, so the complexity overhead of pickled templates is not considered to be worthwhile.

Note that if this is implemented, the pickling should be done at template install time (via a "compiler"), rather than on demand in the application: the later is a security nightmare.

None: PickledTemplates (last edited 2011-02-15 06:05:18 by localhost)