<s> """<STR_LIT>""" <EOL> from time import perf_counter <EOL> def load_lines ( ) : <EOL> with open ( '<STR_LIT>' ) as fp : <EOL> return fp . readlines ( ) * <NUM_LIT:100> <EOL> def chrono ( f ) : <EOL> def inner ( lines ) : <EOL> t0 = perf_counter ( ) <EOL> text = f ( lines ) <EOL> elapsed = perf_counter ( ) - t0 <EOL> print ( '<STR_LIT>' % ( f . __name__ , elapsed ) ) <EOL> return text <EOL> return inner <EOL> @ chrono <EOL> def iadd_joiner ( lines ) : <EOL> text = '<STR_LIT>' <EOL> for line in lines : <EOL> text += line <EOL> return text <EOL> @ chrono <EOL> def list_joiner ( lines ) : <EOL> parts = [ ] <EOL> for line in lines : <EOL> parts . append ( line ) <EOL> return '<STR_LIT>' . join ( parts ) <EOL> @ chrono <EOL> def genexp_joiner ( lines ) : <EOL> return '<STR_LIT>' . join ( line for line in lines ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> lines = load_lines ( ) <EOL> print ( '<STR_LIT>' % len ( lines ) ) <EOL> text0 = iadd_joiner ( lines ) <EOL> text1 = list_joiner ( lines ) <EOL> text2 = genexp_joiner ( lines ) <EOL> assert len ( text0 ) == len ( text1 ) == len ( text2 ) , repr ( <EOL> ( len ( text0 ) , len ( text1 ) , len ( text2 ) ) ) </s>
