<s> import time <EOL> from pykka import ActorRegistry , ThreadingActor <EOL> def time_it ( func ) : <EOL> start = time . time ( ) <EOL> func ( ) <EOL> print ( '<STR_LIT>' % ( func . func_name , time . time ( ) - start ) ) <EOL> class SomeObject ( object ) : <EOL> pykka_traversable = False <EOL> cat = '<STR_LIT>' <EOL> def func ( self ) : <EOL> pass <EOL> class AnActor ( ThreadingActor ) : <EOL> bar = SomeObject ( ) <EOL> bar . pykka_traversable = True <EOL> foo = '<STR_LIT:foo>' <EOL> def __init__ ( self ) : <EOL> super ( AnActor , self ) . __init__ ( ) <EOL> self . cat = '<STR_LIT>' <EOL> def func ( self ) : <EOL> pass <EOL> def test_direct_plain_attribute_access ( ) : <EOL> actor = AnActor . start ( ) . proxy ( ) <EOL> for _ in range ( <NUM_LIT> ) : <EOL> actor . foo . get ( ) <EOL> def test_direct_callable_attribute_access ( ) : <EOL> actor = AnActor . start ( ) . proxy ( ) <EOL> for _ in range ( <NUM_LIT> ) : <EOL> actor . func ( ) . get ( ) <EOL> def test_traversible_plain_attribute_access ( ) : <EOL> actor = AnActor . start ( ) . proxy ( ) <EOL> for _ in range ( <NUM_LIT> ) : <EOL> actor . bar . cat . get ( ) <EOL> def test_traversible_callable_attribute_access ( ) : <EOL> actor = AnActor . start ( ) . proxy ( ) <EOL> for _ in range ( <NUM_LIT> ) : <EOL> actor . bar . func ( ) . get ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> try : <EOL> time_it ( test_direct_plain_attribute_access ) <EOL> time_it ( test_direct_callable_attribute_access ) <EOL> time_it ( test_traversible_plain_attribute_access ) <EOL> time_it ( test_traversible_callable_attribute_access ) <EOL> finally : <EOL> ActorRegistry . stop_all ( ) </s>
