Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 00200000200000400000400000600000600000800000800000100000010000001200000120000014000001400000160000016000001800000180000020000002000000220000022000002400000240000026000002600000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)266290589.78846153846155257.0CPython 2.71950000244.59615384615387323.15699518729764Nuitka (master)1950000399.4038461538462323.15699518729764Nuitka (develop)2050000554.2115384615385313.87707778072905Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 0010000001000000200000020000003000000300000040000004000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)445370689.78846153846155257.00000000000006CPython 3.52596237244.59615384615387360.0622960622353Nuitka (master)2601886399.4038461538462359.74885938552336Nuitka (develop)2599743554.2115384615385359.8677644657488Nuitka (factory)Construct GlobalVariableAccessTicks

Source Code with Construct

module_value1 = 1000
module_value2 = 2000

def calledRepeatedly():
    module_value1
# construct_begin
    return module_value2
# construct_alternative



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 1000
module_value2 = 2000

def calledRepeatedly():
    module_value1
# construct_begin

# construct_alternative
    return None
# construct_end

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
22 module_value2 = 2000 22 module_value2 = 2000
23 23
24 def calledRepeatedly(): 24 def calledRepeatedly():
25     module_value1 25     module_value1
26 # construct_begin 26 # construct_begin
n 27     return module_value2 n 27  
28 # construct_alternative 28 # construct_alternative
t 29   t 29     return None
30   30 # construct_end
31 31
32 import itertools 32 import itertools
33 for x in itertools.repeat(None, 50000): 33 for x in itertools.repeat(None, 50000):
34     calledRepeatedly() 34     calledRepeatedly()
35 35

Context Diff of Generated Code


Construct
Baseline
62 static PyCodeObject *codeobj_b1a7beef3fb19ae0cc86cac3318314ba; 62 static PyCodeObject *codeobj_b1a7beef3fb19ae0cc86cac3318314ba;
63 /* For use in "MainProgram.c". */ 63 /* For use in "MainProgram.c". */
64 PyCodeObject *codeobj_main = NULL; 64 PyCodeObject *codeobj_main = NULL;
65 65
66 static void createModuleCodeObjects(void) { 66 static void createModuleCodeObjects(void) {
n 67     module_filename_obj = mod_consts[3]; CHECK_OBJECT(module_filename_obj); n 67     module_filename_obj = mod_consts[2]; CHECK_OBJECT(module_filename_obj);
68     codeobj_91f4fdd99c7c516c0e204645961d4723 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], mod_consts[17], 0, 0, 0); 68     codeobj_91f4fdd99c7c516c0e204645961d4723 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], mod_consts[17], 0, 0, 0);
69     codeobj_b1a7beef3fb19ae0cc86cac3318314ba = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[17], 0, 0, 0); 69     codeobj_b1a7beef3fb19ae0cc86cac3318314ba = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[17], 0, 0, 0);
70 } 70 }
71 71
72 // The module function declarations. 72 // The module function declarations.
86     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; 86     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused;
87     PyObject *exception_type = NULL; 87     PyObject *exception_type = NULL;
88     PyObject *exception_value = NULL; 88     PyObject *exception_value = NULL;
89     PyTracebackObject *exception_tb = NULL; 89     PyTracebackObject *exception_tb = NULL;
90     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 90     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 91     static struct Nuitka_FrameObject *cache_frame_b1a7beef3fb19ae0cc86cac3318314ba = NULL;
91     PyObject *tmp_return_value = NULL; 92     PyObject *tmp_return_value = NULL;
n 92     static struct Nuitka_FrameObject *cache_frame_b1a7beef3fb19ae0cc86cac3318314ba = NULL; n
93 93
94     // Actual function body. 94     // Actual function body.
95     if (isFrameUnusable(cache_frame_b1a7beef3fb19ae0cc86cac3318314ba)) { 95     if (isFrameUnusable(cache_frame_b1a7beef3fb19ae0cc86cac3318314ba)) {
96         Py_XDECREF(cache_frame_b1a7beef3fb19ae0cc86cac3318314ba); 96         Py_XDECREF(cache_frame_b1a7beef3fb19ae0cc86cac3318314ba);
97 97
137 137
138             goto frame_exception_exit_1; 138             goto frame_exception_exit_1;
139         } 139         }
140 140
141     } 141     }
n 142     { n
143         PyObject *tmp_mvar_value_2;
144         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[1]);
145  
146         if (unlikely(tmp_mvar_value_2 == NULL)) {
147             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[1]);
148         }
149  
150         if (unlikely(tmp_mvar_value_2 == NULL)) {
151  
152             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[1]);
153             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
154             CHAIN_EXCEPTION(exception_value);
155  
156             exception_lineno = 27;
157  
158             goto frame_exception_exit_1;
159         }
160  
161         tmp_return_value = tmp_mvar_value_2;
162         Py_INCREF(tmp_return_value);
163         goto frame_return_exit_1;
164     }
165 142
166 #if 0 143 #if 0
167     RESTORE_FRAME_EXCEPTION(frame_b1a7beef3fb19ae0cc86cac3318314ba); 144     RESTORE_FRAME_EXCEPTION(frame_b1a7beef3fb19ae0cc86cac3318314ba);
168 #endif 145 #endif
169 146
170     // Put the previous frame back on top. 147     // Put the previous frame back on top.
171     popFrameStack(); 148     popFrameStack();
172 149
173     goto frame_no_exception_1; 150     goto frame_no_exception_1;
n 174   n
175     frame_return_exit_1:;
176 #if 0
177     RESTORE_FRAME_EXCEPTION(frame_b1a7beef3fb19ae0cc86cac3318314ba);
178 #endif
179  
180     // Put the previous frame back on top.
181     popFrameStack();
182  
183     goto function_return_exit;
184 151
185     frame_exception_exit_1:; 152     frame_exception_exit_1:;
186 153
187 #if 0 154 #if 0
188     RESTORE_FRAME_EXCEPTION(frame_b1a7beef3fb19ae0cc86cac3318314ba); 155     RESTORE_FRAME_EXCEPTION(frame_b1a7beef3fb19ae0cc86cac3318314ba);
219 186
220     // Return the error. 187     // Return the error.
221     goto function_exception_exit; 188     goto function_exception_exit;
222 189
223     frame_no_exception_1:; 190     frame_no_exception_1:;
n n 191     tmp_return_value = Py_None;
192     Py_INCREF(tmp_return_value);
193     goto function_return_exit;
224 194
225     NUITKA_CANNOT_GET_HERE("Return statement must have exited already."); 195     NUITKA_CANNOT_GET_HERE("Return statement must have exited already.");
226     return NULL; 196     return NULL;
227 197
228 function_exception_exit: 198 function_exception_exit:
646 616
647     // Module code. 617     // Module code.
648     { 618     {
649         PyObject *tmp_assign_source_1; 619         PyObject *tmp_assign_source_1;
650         tmp_assign_source_1 = Py_None; 620         tmp_assign_source_1 = Py_None;
n 651         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 621         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
652     } 622     }
653     { 623     {
654         PyObject *tmp_assign_source_2; 624         PyObject *tmp_assign_source_2;
n 655         tmp_assign_source_2 = mod_consts[3]; n 625         tmp_assign_source_2 = mod_consts[2];
656         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 626         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
657     } 627     }
658     { 628     {
659         PyObject *tmp_assign_source_3; 629         PyObject *tmp_assign_source_3;
660         tmp_assign_source_3 = Py_None; 630         tmp_assign_source_3 = Py_None;
n 661         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 631         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
662     } 632     }
663     { 633     {
664         PyObject *tmp_assign_source_4; 634         PyObject *tmp_assign_source_4;
n 665         tmp_assign_source_4 = mod_consts[6]; n 635         tmp_assign_source_4 = mod_consts[5];
666         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 636         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
667     } 637     }
668     { 638     {
669         PyObject *tmp_assign_source_5; 639         PyObject *tmp_assign_source_5;
t 670         tmp_assign_source_5 = mod_consts[7]; t 640         tmp_assign_source_5 = mod_consts[6];
671         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); 641         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_5);
672     } 642     }
673     { 643     {
674         PyObject *tmp_assign_source_6; 644         PyObject *tmp_assign_source_6;
675 645
676 646