<s> import re <EOL> import time <EOL> def main ( ) : <EOL> s = "<STR_LIT>" * <NUM_LIT:1000> <EOL> p = re . compile ( r"<STR_LIT>" ) <EOL> timefunc ( <NUM_LIT:10> , p . sub , "<STR_LIT>" , s ) <EOL> timefunc ( <NUM_LIT:10> , p . split , s ) <EOL> timefunc ( <NUM_LIT:10> , p . findall , s ) <EOL> def timefunc ( n , func , * args , ** kw ) : <EOL> t0 = time . clock ( ) <EOL> try : <EOL> for i in range ( n ) : <EOL> result = func ( * args , ** kw ) <EOL> return result <EOL> finally : <EOL> t1 = time . clock ( ) <EOL> if n > <NUM_LIT:1> : <EOL> print n , "<STR_LIT>" , <EOL> print func . __name__ , "<STR_LIT>" % ( t1 - t0 ) , "<STR_LIT>" <EOL> main ( ) </s>
