Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)742642874.3076923076923257.0CPython 2.72450159198.15384615384616422.58601630347937Nuitka (historic)2350276322.0425.9096364828628Nuitka (master)2350159445.8461538461538425.91352967350576Nuitka (develop)2350129569.6923076923077425.91452792751676Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)772429474.3076923076923257.0CPython 3.50198.15384615384616504.11538461538464Nuitka (historic)2748907322.0416.1724333790745Nuitka (master)2749940445.8461538461538416.1393856737039Nuitka (develop)2751110569.6923076923077416.1019550683955Nuitka (factory)Construct LocalVariableAccessTicks

Source Code with Construct

module_value1 = 1000
module_value2 = None
module_value3 = None

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    # Use writing to global variable as access method.
    global module_value2, module_value3

# construct_begin
    module_value2 = local_value
# construct_end

    module_value3 = local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 1000
module_value2 = None
module_value3 = None

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    # Use writing to global variable as access method.
    global module_value2, module_value3

# construct_begin



    module_value3 = local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
29 29
30     # Use writing to global variable as access method. 30     # Use writing to global variable as access method.
31     global module_value2, module_value3 31     global module_value2, module_value3
32 32
33 # construct_begin 33 # construct_begin
t 34     module_value2 = local_value t 34  
35 # construct_end 35  
36 36
37     module_value3 = local_value 37     module_value3 = local_value
38 38
39 for x in xrange(50000): 39 for x in xrange(50000):
40     calledRepeatedly() 40     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
127     PyObject *exception_keeper_value_1; 127     PyObject *exception_keeper_value_1;
128     PyTracebackObject *exception_keeper_tb_1; 128     PyTracebackObject *exception_keeper_tb_1;
129     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 129     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
130     PyObject *tmp_assign_source_1; 130     PyObject *tmp_assign_source_1;
131     PyObject *tmp_assign_source_2; 131     PyObject *tmp_assign_source_2;
n 132     PyObject *tmp_assign_source_3; n
133     PyObject *tmp_return_value; 132     PyObject *tmp_return_value;
134     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 133     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
135     static struct Nuitka_FrameObject *cache_frame_b2a74abf5ab20b9c209a72f057736e4d = NULL; 134     static struct Nuitka_FrameObject *cache_frame_b2a74abf5ab20b9c209a72f057736e4d = NULL;
136 135
137     struct Nuitka_FrameObject *frame_b2a74abf5ab20b9c209a72f057736e4d; 136     struct Nuitka_FrameObject *frame_b2a74abf5ab20b9c209a72f057736e4d;
245     frame_no_exception_1:; 244     frame_no_exception_1:;
246 245
247     tmp_assign_source_2 = var_local_value; 246     tmp_assign_source_2 = var_local_value;
248 247
249     CHECK_OBJECT( tmp_assign_source_2 ); 248     CHECK_OBJECT( tmp_assign_source_2 );
t 250     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2, tmp_assign_source_2 ); t 249     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_2 );
251     tmp_assign_source_3 = var_local_value;
252  
253     CHECK_OBJECT( tmp_assign_source_3 );
254     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_3 );
255     tmp_return_value = Py_None; 250     tmp_return_value = Py_None;
256     Py_INCREF( tmp_return_value ); 251     Py_INCREF( tmp_return_value );
257     goto try_return_handler_1; 252     goto try_return_handler_1;
258     // tried codes exits in all cases 253     // tried codes exits in all cases
259     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 254     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );