Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)778496589.78846153846155257.0CPython 2.72750883244.59615384615387416.7950805964298Nuitka (master)2750617399.4038461538462416.8035241401461Nuitka (develop)2750847554.2115384615385416.7962233316696Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)877296189.78846153846155257.00000000000006CPython 3.53300403244.59615384615387411.1501523829868Nuitka (master)3299905399.4038461538462411.1641799686034Nuitka (develop)3300301554.2115384615385411.15302550293234Nuitka (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
248     frame_no_exception_1:; 248     frame_no_exception_1:;
249     { 249     {
250         PyObject *tmp_assign_source_2; 250         PyObject *tmp_assign_source_2;
251         CHECK_OBJECT(var_local_value); 251         CHECK_OBJECT(var_local_value);
252         tmp_assign_source_2 = var_local_value; 252         tmp_assign_source_2 = var_local_value;
t 253         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2, tmp_assign_source_2); t 253         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_2);
254     }
255     {
256         PyObject *tmp_assign_source_3;
257         CHECK_OBJECT(var_local_value);
258         tmp_assign_source_3 = var_local_value;
259         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value3, tmp_assign_source_3);
260     } 254     }
261     tmp_return_value = Py_None; 255     tmp_return_value = Py_None;
262     Py_INCREF(tmp_return_value); 256     Py_INCREF(tmp_return_value);
263     goto try_return_handler_1; 257     goto try_return_handler_1;
264     // tried codes exits in all cases 258     // tried codes exits in all cases