From 6cc2b236eacb70bef367d9500bbd65313d42626d Mon Sep 17 00:00:00 2001 From: Rodrigo Moraes Date: Tue, 17 Aug 2010 12:08:01 -0300 Subject: [PATCH] Added benchmark for chameleon/chameleon-genshi. --HG-- branch : trunk --- examples/bench.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) 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 -- 2.26.2