<s> """<STR_LIT>""" <EOL> import sys <EOL> import cgi <EOL> from timeit import Timer <EOL> from jinja2 import Environment as JinjaEnvironment <EOL> context = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ dict ( a = <NUM_LIT:1> , b = <NUM_LIT:2> , c = <NUM_LIT:3> , d = <NUM_LIT:4> , e = <NUM_LIT:5> , f = <NUM_LIT:6> , g = <NUM_LIT:7> , h = <NUM_LIT:8> , i = <NUM_LIT:9> , j = <NUM_LIT:10> ) for x in range ( <NUM_LIT:1000> ) ] <EOL> } <EOL> jinja_template = JinjaEnvironment ( <EOL> line_statement_prefix = '<STR_LIT:%>' , <EOL> variable_start_string = "<STR_LIT>" , <EOL> variable_end_string = "<STR_LIT:}>" <EOL> ) . from_string ( """<STR_LIT>""" ) <EOL> def test_jinja ( ) : <EOL> jinja_template . render ( context ) <EOL> try : <EOL> from tornado . template import Template <EOL> except ImportError : <EOL> test_tornado = None <EOL> else : <EOL> tornado_template = Template ( """<STR_LIT>""" ) <EOL> def test_tornado ( ) : <EOL> tornado_template . generate ( ** context ) <EOL> try : <EOL> from django . conf import settings <EOL> settings . configure ( ) <EOL> from django . template import Template as DjangoTemplate , Context as DjangoContext <EOL> except ImportError : <EOL> test_django = None <EOL> else : <EOL> django_template = DjangoTemplate ( """<STR_LIT>""" ) <EOL> def test_django ( ) : <EOL> c = DjangoContext ( context ) <EOL> c [ '<STR_LIT>' ] = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> django_template . render ( c ) <EOL> try : <EOL> from mako . template import Template as MakoTemplate <EOL> except ImportError : <EOL> test_mako = None <EOL> else : <EOL> mako_template = MakoTemplate ( """<STR_LIT>""" ) <EOL> def test_mako ( ) : <EOL> mako_template . render ( ** context ) <EOL> try : <EOL> from genshi . template import MarkupTemplate as GenshiTemplate <EOL> except ImportError : <EOL> test_genshi = None <EOL> else : <EOL> genshi_template = GenshiTemplate ( """<STR_LIT>""" ) <EOL> def test_genshi ( ) : <EOL> genshi_template . generate ( ** context ) . render ( '<STR_LIT:html>' , strip_whitespace = False ) <EOL> try : <EOL> from Cheetah . Template import Template as CheetahTemplate <EOL> except ImportError : <EOL> test_cheetah = None <EOL> else : <EOL> cheetah_template = CheetahTemplate ( """<STR_LIT>""" , searchList = [ dict ( context ) ] ) <EOL> def test_cheetah ( ) : <EOL> unicode ( cheetah_template ) <EOL> try : <EOL> import tenjin <EOL> except ImportError : <EOL> test_tenjin = None <EOL> else : <EOL> tenjin_template = tenjin . Template ( ) <EOL> tenjin_template . convert ( """<STR_LIT>""" ) <EOL> def test_tenjin ( ) : <EOL> from tenjin . helpers import escape , to_str <EOL> tenjin_template . render ( context , locals ( ) ) <EOL> try : <EOL> from spitfire . compiler import util as SpitfireTemplate <EOL> from spitfire . compiler . analyzer import o2_options as spitfire_optimizer <EOL> except ImportError : <EOL> test_spitfire = None <EOL> else : <EOL> spitfire_template = SpitfireTemplate . load_template ( """<STR_LIT>""" , '<STR_LIT>' , spitfire_optimizer , { '<STR_LIT>' : False } ) <EOL> spitfire_context = dict ( context , ** { '<STR_LIT>' : cgi } ) <EOL> def test_spitfire ( ) : <EOL> spitfire_template ( search_list = [ spitfire_context ] ) . main ( ) <EOL> try : <EOL> from chameleon . zpt . template import PageTemplate <EOL> except ImportError : <EOL> test_chameleon = None <EOL> else : <EOL> chameleon_template = PageTemplate ( """<STR_LIT>""" ) <EOL> chameleon_context = dict ( context ) <EOL> chameleon_context [ '<STR_LIT>' ] = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ] <EOL> def test_chameleon ( ) : <EOL> chameleon_template . render ( ** chameleon_context ) <EOL> try : <EOL> from chameleon . zpt . template import PageTemplate <EOL> from chameleon . genshi import language <EOL> except ImportError : <EOL> test_chameleon_genshi = None <EOL> else : <EOL> chameleon_genshi_template = PageTemplate ( """<STR_LIT>""" , parser = language . Parser ( ) ) <EOL> chameleon_genshi_context = dict ( context ) <EOL> chameleon_genshi_context [ '<STR_LIT>' ] = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ] <EOL> def test_chameleon_genshi ( ) : <EOL> chameleon_genshi_template . render ( ** chameleon_genshi_context ) <EOL> sys . stdout . write ( '<STR_LIT:\r>' + '<STR_LIT:\n>' . join ( ( <EOL> '<STR_LIT:=>' * <NUM_LIT> , <EOL> '<STR_LIT>' . center ( <NUM_LIT> ) , <EOL> '<STR_LIT:=>' * <NUM_LIT> , <EOL> __doc__ , <EOL> '<STR_LIT:->' * <NUM_LIT> <EOL> ) ) + '<STR_LIT:\n>' ) <EOL> for test in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> if locals ( ) [ '<STR_LIT>' + test ] is None : <EOL> sys . stdout . write ( '<STR_LIT>' % test ) <EOL> continue <EOL> t = Timer ( setup = '<STR_LIT>' % test , <EOL> stmt = '<STR_LIT>' ) <EOL> sys . stdout . write ( '<STR_LIT>' % test ) <EOL> sys . stdout . flush ( ) <EOL> sys . stdout . write ( '<STR_LIT>' % ( test , t . timeit ( number = <NUM_LIT:50> ) / <NUM_LIT:50> ) ) <EOL> sys . stdout . write ( '<STR_LIT:->' * <NUM_LIT> + '<STR_LIT:\n>' ) <EOL> sys . stdout . write ( '''<STR_LIT>''' + '<STR_LIT:=>' * <NUM_LIT> + '<STR_LIT:\n>' ) </s>
