Example #1
0
def test_django():
    # not cached because django is not thread safe and does
    # not cache by itself so it would be unfair to cache it here.
    django_template = django_loader.get_template('index.html')
    django_template.render(DjangoContext(context))
Example #2
0

jinja_template = jinja_env.get_template('index.html')
mako_template = mako_lookup.get_template('index.html')
genshi_template = genshi_loader.load('index.html')


def test_jinja():
    jinja_template.render(context)

def test_mako():
    mako_template.render_unicode(**context)


from djangoext import django_loader, DjangoContext
django_template = django_loader.get_template('index.html')
def test_django():
    django_template.render(DjangoContext(context))


def test_genshi():
    genshi_template.generate(**context).render('html', doctype='html')


if __name__ == '__main__':
    sys.stdout.write('Realworldish Benchmark:\n')
    for test in 'jinja', 'mako', 'django', 'genshi':
        t = Timer(setup='from __main__ import test_%s as bench' % test,
                  stmt='bench()')
        sys.stdout.write(' >> %-20s<running>' % test)
        sys.stdout.flush()
Example #3
0
def test_django():
    # not cached because django is not thread safe and does
    # not cache by itself so it would be unfair to cache it here.
    django_template = django_loader.get_template('index.html')
    django_template.render(DjangoContext(context))
Example #4
0
jinja_template = jinja_env.get_template('index.html')
mako_template = mako_lookup.get_template('index.html')
genshi_template = genshi_loader.load('index.html')


def test_jinja():
    jinja_template.render(context)


def test_mako():
    mako_template.render_unicode(**context)


from djangoext import django_loader, DjangoContext

django_template = django_loader.get_template('index.html')


def test_django():
    django_template.render(DjangoContext(context))


def test_genshi():
    genshi_template.generate(**context).render('html', doctype='html')


if __name__ == '__main__':
    sys.stdout.write('Realworldish Benchmark:\n')
    for test in 'jinja', 'mako', 'django', 'genshi':
        t = Timer(setup='from __main__ import test_%s as bench' % test,
                  stmt='bench()')