<s> from time import time <EOL> from twisted . python . usage import Options <EOL> from nevow . json import serialize , parse <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from json_string_tokenizer import main <EOL> raise SystemExit ( main ( ) ) <EOL> class StringTokenizer ( Options ) : <EOL> optParameters = [ <EOL> ( '<STR_LIT>' , '<STR_LIT:i>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:s>' , '<STR_LIT:100>' , '<STR_LIT>' ) ] <EOL> def postOptions ( self ) : <EOL> self [ '<STR_LIT>' ] = int ( self [ '<STR_LIT>' ] ) <EOL> self [ '<STR_LIT>' ] = int ( self [ '<STR_LIT>' ] ) <EOL> BASE = u'<STR_LIT>' <EOL> def benchmark ( iterations , scale ) : <EOL> """<STR_LIT>""" <EOL> s = serialize ( BASE * scale ) <EOL> before = time ( ) <EOL> for i in xrange ( iterations ) : <EOL> parse ( s ) <EOL> after = time ( ) <EOL> print ( after - before ) / iterations , '<STR_LIT>' <EOL> def main ( args = None ) : <EOL> """<STR_LIT>""" <EOL> options = StringTokenizer ( ) <EOL> options . parseOptions ( args ) <EOL> benchmark ( options [ '<STR_LIT>' ] , options [ '<STR_LIT>' ] ) </s>
