Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)742642874.3076923076923257.0CPython 2.72450159198.15384615384616422.58601630347937Nuitka (historic)2350159322.0425.91352967350576Nuitka (master)2350153445.8461538461538425.91372932430795Nuitka (develop)2350153569.6923076923077425.91372932430795Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)772429474.3076923076923257.0CPython 3.50198.15384615384616504.11538461538464Nuitka (historic)2754127322.0416.00543529385243Nuitka (master)2748135445.8461538461538416.19713118018393Nuitka (develop)2745223569.6923076923077416.2902917978404Nuitka (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
128     PyObject *exception_keeper_value_1; 128     PyObject *exception_keeper_value_1;
129     PyTracebackObject *exception_keeper_tb_1; 129     PyTracebackObject *exception_keeper_tb_1;
130     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 130     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
131     PyObject *tmp_assign_source_1; 131     PyObject *tmp_assign_source_1;
132     PyObject *tmp_assign_source_2; 132     PyObject *tmp_assign_source_2;
n 133     PyObject *tmp_assign_source_3; n
134     PyObject *tmp_frame_locals; 133     PyObject *tmp_frame_locals;
135     PyObject *tmp_return_value; 134     PyObject *tmp_return_value;
136     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 135     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
137     static PyFrameObject *cache_frame_function = NULL; 136     static PyFrameObject *cache_frame_function = NULL;
138 137
270 269
271     frame_no_exception_1:; 270     frame_no_exception_1:;
272 271
273     tmp_assign_source_2 = var_local_value; 272     tmp_assign_source_2 = var_local_value;
274 273
t 275     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2, tmp_assign_source_2 ); t 274     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_2 );
276     tmp_assign_source_3 = var_local_value;
277  
278     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_3 );
279     tmp_return_value = Py_None; 275     tmp_return_value = Py_None;
280     Py_INCREF( tmp_return_value ); 276     Py_INCREF( tmp_return_value );
281     goto try_return_handler_1; 277     goto try_return_handler_1;
282     // tried codes exits in all cases 278     // tried codes exits in all cases
283     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 279     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );