Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 00200000200000400000400000600000600000800000800000100000010000001200000120000014000001400000160000016000001800000180000020000002000000220000022000002400000240000026000002600000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)266295389.78846153846155257.0CPython 2.72050000244.59615384615387313.88050684565366Nuitka (master)2600000399.4038461538462262.84188110255513Nuitka (develop)2600000554.2115384615385262.84188110255513Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 0010000001000000200000020000003000000300000040000004000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)445373289.78846153846155257.0CPython 3.52600001244.59615384615387359.8542914208716Nuitka (master)3700001399.4038461538462298.82077546685304Nuitka (develop)3700001554.2115384615385298.82077546685304Nuitka (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_1ef7c8a1ef1547c15388d6726065dd86; 62 static PyCodeObject *codeobj_1ef7c8a1ef1547c15388d6726065dd86;
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_75104854990dcc18a9dca3a2b6bc974d = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], mod_consts[17], 0, 0, 0); 68     codeobj_75104854990dcc18a9dca3a2b6bc974d = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], mod_consts[17], 0, 0, 0);
69     codeobj_1ef7c8a1ef1547c15388d6726065dd86 = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[17], 0, 0, 0); 69     codeobj_1ef7c8a1ef1547c15388d6726065dd86 = 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_1ef7c8a1ef1547c15388d6726065dd86 = NULL;
91     PyObject *tmp_return_value = NULL; 92     PyObject *tmp_return_value = NULL;
n 92     static struct Nuitka_FrameObject *cache_frame_1ef7c8a1ef1547c15388d6726065dd86 = NULL; n
93 93
94     // Actual function body. 94     // Actual function body.
95     if (isFrameUnusable(cache_frame_1ef7c8a1ef1547c15388d6726065dd86)) { 95     if (isFrameUnusable(cache_frame_1ef7c8a1ef1547c15388d6726065dd86)) {
96         Py_XDECREF(cache_frame_1ef7c8a1ef1547c15388d6726065dd86); 96         Py_XDECREF(cache_frame_1ef7c8a1ef1547c15388d6726065dd86);
97 97
131             exception_lineno = 25; 131             exception_lineno = 25;
132 132
133             goto frame_exception_exit_1; 133             goto frame_exception_exit_1;
134         } 134         }
135     } 135     }
n 136     tmp_return_value = GET_MODULE_VARIABLE_VALUE(moduledict___main__, mod_consts[1]); n
137     if (tmp_return_value == NULL) {
138         assert(ERROR_OCCURRED());
139  
140         FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
141  
142  
143         exception_lineno = 27;
144  
145         goto frame_exception_exit_1;
146     }
147     Py_INCREF(tmp_return_value);
148     goto frame_return_exit_1;
149 136
150 #if 0 137 #if 0
151     RESTORE_FRAME_EXCEPTION(frame_1ef7c8a1ef1547c15388d6726065dd86); 138     RESTORE_FRAME_EXCEPTION(frame_1ef7c8a1ef1547c15388d6726065dd86);
152 #endif 139 #endif
153 140
154     // Put the previous frame back on top. 141     // Put the previous frame back on top.
155     popFrameStack(); 142     popFrameStack();
156 143
157     goto frame_no_exception_1; 144     goto frame_no_exception_1;
n 158   n
159     frame_return_exit_1:;
160 #if 0
161     RESTORE_FRAME_EXCEPTION(frame_1ef7c8a1ef1547c15388d6726065dd86);
162 #endif
163  
164     // Put the previous frame back on top.
165     popFrameStack();
166  
167     goto function_return_exit;
168 145
169     frame_exception_exit_1:; 146     frame_exception_exit_1:;
170 147
171 #if 0 148 #if 0
172     RESTORE_FRAME_EXCEPTION(frame_1ef7c8a1ef1547c15388d6726065dd86); 149     RESTORE_FRAME_EXCEPTION(frame_1ef7c8a1ef1547c15388d6726065dd86);
203 180
204     // Return the error. 181     // Return the error.
205     goto function_exception_exit; 182     goto function_exception_exit;
206 183
207     frame_no_exception_1:; 184     frame_no_exception_1:;
n n 185     tmp_return_value = Py_None;
186     Py_INCREF(tmp_return_value);
187     goto function_return_exit;
208 188
209     NUITKA_CANNOT_GET_HERE("Return statement must have exited already."); 189     NUITKA_CANNOT_GET_HERE("Return statement must have exited already.");
210     return NULL; 190     return NULL;
211 191
212 function_exception_exit: 192 function_exception_exit:
631 611
632     // Module code. 612     // Module code.
633     { 613     {
634         PyObject *tmp_assign_source_1; 614         PyObject *tmp_assign_source_1;
635         tmp_assign_source_1 = Py_None; 615         tmp_assign_source_1 = Py_None;
n 636         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 616         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
637     } 617     }
638     { 618     {
639         PyObject *tmp_assign_source_2; 619         PyObject *tmp_assign_source_2;
n 640         tmp_assign_source_2 = mod_consts[3]; n 620         tmp_assign_source_2 = mod_consts[2];
641         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 621         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
642     } 622     }
643     { 623     {
644         PyObject *tmp_assign_source_3; 624         PyObject *tmp_assign_source_3;
645         tmp_assign_source_3 = Py_None; 625         tmp_assign_source_3 = Py_None;
n 646         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 626         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
647     } 627     }
648     { 628     {
649         PyObject *tmp_assign_source_4; 629         PyObject *tmp_assign_source_4;
n 650         tmp_assign_source_4 = mod_consts[6]; n 630         tmp_assign_source_4 = mod_consts[5];
651         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 631         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
652     } 632     }
653     { 633     {
654         PyObject *tmp_assign_source_5; 634         PyObject *tmp_assign_source_5;
t 655         tmp_assign_source_5 = mod_consts[7]; t 635         tmp_assign_source_5 = mod_consts[6];
656         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); 636         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_5);
657     } 637     }
658     { 638     {
659         PyObject *tmp_assign_source_6; 639         PyObject *tmp_assign_source_6;
660 640
661 641