From: Rodrigo Moraes Date: Tue, 17 Aug 2010 15:08:01 +0000 (-0300) Subject: Added benchmark for chameleon/chameleon-genshi. X-Git-Tag: 2.5.3~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6cc2b236eacb70bef367d9500bbd65313d42626d;p=jinja2.git Added benchmark for chameleon/chameleon-genshi. --HG-- branch : trunk --- diff --git a/examples/bench.py b/examples/bench.py index ab3d4b0..c648dc6 100644 --- a/examples/bench.py +++ b/examples/bench.py @@ -330,6 +330,81 @@ else: def test_spitfire(): spitfire_template(search_list=[spitfire_context]).main() + +try: + from chameleon.zpt.template import PageTemplate +except ImportError: + test_chameleon = None +else: + chameleon_template = PageTemplate("""\ + + + Page Title + + +
+

Page Title

+
+ +
+ + + + +
cell
+
+ +\ +""") + chameleon_context = dict(context) + chameleon_context['sections'] = [ + ('index.html', 'Index'), + ('downloads.html', 'Downloads'), + ('products.html', 'Products') + ] + def test_chameleon(): + chameleon_template.render(**chameleon_context) + +try: + from chameleon.zpt.template import PageTemplate + from chameleon.genshi import language +except ImportError: + test_chameleon_genshi = None +else: + chameleon_genshi_template = PageTemplate("""\ + + + ${page_title} + + +
+

${page_title}

+
+ +
+ + + + +
${row[cell]}
+
+ +\ +""", parser=language.Parser()) + chameleon_genshi_context = dict(context) + chameleon_genshi_context['sections'] = [ + ('index.html', 'Index'), + ('downloads.html', 'Downloads'), + ('products.html', 'Products') + ] + def test_chameleon_genshi(): + chameleon_genshi_template.render(**chameleon_genshi_context) + + sys.stdout.write('\r' + '\n'.join(( '=' * 80, 'Template Engine BigTable Benchmark'.center(80), @@ -339,7 +414,7 @@ sys.stdout.write('\r' + '\n'.join(( )) + '\n') -for test in 'jinja', 'mako', 'tornado', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah': +for test in 'jinja', 'mako', 'tornado', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah', 'chameleon', 'chameleon_genshi': if locals()['test_' + test] is None: sys.stdout.write(' %-20s*not installed*\n' % test) continue