<s> from __future__ import print_function <EOL> from time import time <EOL> import tables <EOL> print ( "<STR_LIT>" , tables . __version__ ) <EOL> filename = "<STR_LIT>" <EOL> NOBJS = <NUM_LIT:1000> <EOL> def create_junk ( ) : <EOL> fileh = tables . open_file ( filename , mode = "<STR_LIT:w>" ) <EOL> for i in range ( NOBJS ) : <EOL> fileh . create_array ( fileh . root , '<STR_LIT>' + str ( i ) , [ <NUM_LIT:1> ] ) <EOL> fileh . close ( ) <EOL> def modify_junk_LRU ( ) : <EOL> fileh = tables . open_file ( filename , '<STR_LIT:a>' ) <EOL> group = fileh . root <EOL> for j in range ( <NUM_LIT:5> ) : <EOL> print ( "<STR_LIT>" , j ) <EOL> for tt in fileh . walk_nodes ( group ) : <EOL> if isinstance ( tt , tables . Array ) : <EOL> pass <EOL> fileh . close ( ) <EOL> def modify_junk_LRU2 ( ) : <EOL> fileh = tables . open_file ( filename , '<STR_LIT:a>' ) <EOL> group = fileh . root <EOL> for j in range ( <NUM_LIT:5> ) : <EOL> t1 = time ( ) <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> tt = getattr ( group , "<STR_LIT>" + str ( i ) ) <EOL> print ( "<STR_LIT>" , j + <NUM_LIT:1> , round ( time ( ) - t1 , <NUM_LIT:3> ) ) <EOL> fileh . close ( ) <EOL> if <NUM_LIT:1> : <EOL> modify_junk_LRU2 ( ) <EOL> else : <EOL> import profile <EOL> import pstats <EOL> profile . run ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> stats = pstats . Stats ( '<STR_LIT>' ) <EOL> stats . strip_dirs ( ) <EOL> stats . sort_stats ( '<STR_LIT:time>' , '<STR_LIT>' ) <EOL> stats . print_stats ( ) </s>
