#!/usr/bin/env python import time import sys from tdi.template import html tpl = html.from_string(""" <x> <y tdi="zonk"> <z tdi="zapp"> </z> </y> </x> """) class Model(object): def render_zonk(self, node): node.repeat(None, xrange(10000)) def render_zapp(self, node): node.content = node.ctx[1] idx = 0 while 1: m = Model() tpl.render_string(m) idx += 1 if idx >= 10: sys.stdout.write(".")
#!/usr/bin/env python HUGE = 10000000 HUGE = 1000000 # HUGE = 1000 from tdi.template import html # import gc; gc.disable() template = html.from_string("""<node tdi="item"></node>""") class DevNull(object): def write(self, s): pass class Model(object): def render_item(self, node): node.repeat(self.repeat_item, xrange(HUGE)) def repeat_item(self, node, item): pass # node.content = unicode(item) model = Model() template.render(model, DevNull())