Skip to content
Myr

and added genshi to rwbench too. want to see how much the GSOC improves performance :)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 9cc7803 · Browse files · 7 files+94 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+94 added−4 removed

  • other:+94 added−4 removed

7 files+94 added−4 removed

modified:examples/rwbench/django/index.html+1 added-1 removed
added:examples/rwbench/genshi/helpers.html+12 added
added:examples/rwbench/genshi/index.html+41 added
added:examples/rwbench/genshi/layout.html+30 added
modified:examples/rwbench/jinja/index.html+1 added-1 removed
modified:examples/rwbench/mako/index.html+1 added-1 removed
modified:examples/rwbench/rwbench.py+8 added-1 removed
18 unmodified lines
19from timeit import Timer20from jinja2 import Environment, FileSystemLoader21from jinja2.utils import generate_lorem_ipsum22from mako.lookup import TemplateLookup23from genshi.template import TemplateLoader as GenshiTemplateLoader242526def dateformat(x):27 return x.strftime('%Y-%m-%d')
1 unmodified line
2930jinja_env = Environment(loader=FileSystemLoader(join(ROOT, 'jinja')))31jinja_env.filters['dateformat'] = dateformat32mako_lookup = TemplateLookup(directories=[join(ROOT, 'mako')])33genshi_loader = GenshiTemplateLoader([join(ROOT, 'genshi')])3435class Article(object):3637 def __init__(self, id):
28 unmodified lines
666768jinja_template = jinja_env.get_template('index.html')69mako_template = mako_lookup.get_template('index.html')70genshi_template = genshi_loader.load('index.html')717273def test_jinja():74 jinja_template.render(context)
7 unmodified lines
82def test_django():83 django_template.render(DjangoContext(context))848586def test_genshi():87 genshi_template.generate(**context).render('html', doctype='html')888990if __name__ == '__main__':91 sys.stdout.write('Realworldish Benchmark:\n')85 for test in 'jinja', 'mako', 'django':92 for test in 'jinja', 'mako', 'django', 'genshi':93 t = Timer(setup='from __main__ import test_%s as bench' % test,94 stmt='bench()')95 sys.stdout.write(' >> %-20s<running>' % test)96 sys.stdout.flush()
1 unmodified line