Skip to content
Myr

Added tornado templates to benchmark.

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 bd35772 · Browse files · 1 file+43 added−1 removed
This commit

State

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

Diff stats

1 file+43 added−1 removed

  • other:+43 added−1 removed

1 file+43 added−1 removed

modified:examples/bench.py+43 added-1 removed
53 unmodified lines
54def test_jinja():55 jinja_template.render(context)5657try:58 from tornado.template import Template59except ImportError:60 test_tornado = None61else:62 tornado_template = Template("""\63<!doctype html>64<html>65 <head>66 <title>{{ page_title }}</title>67 </head>68 <body>69 <div class="header">70 <h1>{{ page_title }}</h1>71 </div>72 <ul class="navigation">73 {% for href, caption in [ \74 ('index.html', 'Index'), \75 ('downloads.html', 'Downloads'), \76 ('products.html', 'Products') \77 ] %}78 <li><a href="{{ href }}">{{ caption }}</a></li>79 {% end %}80 </ul>81 <div class="table">82 <table>83 {% for row in table %}84 <tr>85 {% for cell in row %}86 <td>{{ cell }}</td>87 {% end %}88 </tr>89 {% end %}90 </table>91 </div>92 </body>93</html>\94""")9596 def test_tornado():97 tornado_template.generate(**context)9899try:100 from django.conf import settings101 settings.configure()102 from django.template import Template as DjangoTemplate, Context as DjangoContext103except ImportError:
237 unmodified lines
341 '-' * 80342)) + '\n')343344303for test in 'jinja', 'mako', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah':345for test in 'jinja', 'mako', 'tornado', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah':346 if locals()['test_' + test] is None:347 sys.stdout.write(' %-20s*not installed*\n' % test)348 continue349 t = Timer(setup='from __main__ import test_%s as bench' % test,
12 unmodified lines