Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)742646789.78846153846155257.0CPython 2.72350081244.59615384615387425.91653579638256Nuitka (master)2350165399.4038461538462425.9137406998302Nuitka (develop)2350123554.2115384615385425.9151382481064Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)772400789.78846153846155257.0CPython 3.52758292244.59615384615387415.86890989552245Nuitka (master)2758810399.4038461538462415.85233743912374Nuitka (develop)2759978554.2115384615385415.814969429329Nuitka (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

import itertools
for x in itertools.repeat(None, 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

import itertools
for x in itertools.repeat(None, 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 import itertools 39 import itertools
40 for x in itertools.repeat(None, 50000): 40 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
136     PyObject *exception_keeper_value_1; 136     PyObject *exception_keeper_value_1;
137     PyTracebackObject *exception_keeper_tb_1; 137     PyTracebackObject *exception_keeper_tb_1;
138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
139     PyObject *tmp_assign_source_1; 139     PyObject *tmp_assign_source_1;
140     PyObject *tmp_assign_source_2; 140     PyObject *tmp_assign_source_2;
n 141     PyObject *tmp_assign_source_3; n
142     PyObject *tmp_return_value; 141     PyObject *tmp_return_value;
143     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 142     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
144     static struct Nuitka_FrameObject *cache_frame_6a7a005f430ee7fd57f287bde6b932a9 = NULL; 143     static struct Nuitka_FrameObject *cache_frame_6a7a005f430ee7fd57f287bde6b932a9 = NULL;
145 144
146     struct Nuitka_FrameObject *frame_6a7a005f430ee7fd57f287bde6b932a9; 145     struct Nuitka_FrameObject *frame_6a7a005f430ee7fd57f287bde6b932a9;
259     frame_no_exception_1:; 258     frame_no_exception_1:;
260 259
261     tmp_assign_source_2 = var_local_value; 260     tmp_assign_source_2 = var_local_value;
262 261
263     CHECK_OBJECT( tmp_assign_source_2 ); 262     CHECK_OBJECT( tmp_assign_source_2 );
t 264     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2, tmp_assign_source_2 ); t 263     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_2 );
265     tmp_assign_source_3 = var_local_value;
266  
267     CHECK_OBJECT( tmp_assign_source_3 );
268     UPDATE_STRING_DICT0( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_3 );
269     tmp_return_value = Py_None; 264     tmp_return_value = Py_None;
270     Py_INCREF( tmp_return_value ); 265     Py_INCREF( tmp_return_value );
271     goto try_return_handler_1; 266     goto try_return_handler_1;
272     // tried codes exits in all cases 267     // tried codes exits in all cases
273     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 268     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );