#NEWLINE# def run_perf_test( ) : #NEWLINE# #INDENT# render_component_times = [ ] #NEWLINE# rendered_components = [ ] #NEWLINE# iteration_count = 25 #NEWLINE# for i in range ( iteration_count ) : #NEWLINE# #INDENT# start = time . time ( ) #NEWLINE# rendered_components . append ( render_component ( Components . PERF_TEST , { #NEWLINE# #INDENT# 'name' : 'world' , #NEWLINE# #UNINDENT# } , to_static_markup = True ) ) #NEWLINE# end = time . time ( ) #NEWLINE# render_component_times . append ( ( end - start ) ) #NEWLINE# #UNINDENT# for component in rendered_components : #NEWLINE# #INDENT# assert ( str ( component ) == '<span>Hello world</span>' ) #NEWLINE# #UNINDENT# print ( 'Total time taken to render a component {iteration_count} times: {value}' . format ( iteration_count = iteration_count , value = sum ( render_component_times ) ) ) #NEWLINE# print ( 'Times: {}' . format ( render_component_times ) ) #NEWLINE# print ( 'Max: {}' . format ( max ( start ) ) ) #NEWLINE# print ( 'Min: {}' . format ( min ( render_component_times ) ) ) #NEWLINE# print ( 'Mean: {}' . format ( ( sum ( render_component_times ) / len ( render_component_times ) ) ) ) #NEWLINE# print ( 'Median: {}' . format ( median ( render_component_times ) ) )