import timeit print timeit.repeat("array( 'B', map(ord,a) ).tostring()",setup="from array import array;a = list('all the world is a stage and all the men and women merely players')") print timeit.repeat("''.join(a)",setup="from array import array;a = list('all the world is a stage and all the men and women merely players')")