Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 00200000200000400000400000600000600000800000800000100000010000001200000120000014000001400000160000016000001800000180000020000002000000220000022000002400000240000026000002600000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)266296189.78846153846155257.0CPython 2.72050000244.59615384615387313.881078344456Nuitka (master)2050000399.4038461538462313.881078344456Nuitka (develop)2050000554.2115384615385313.881078344456Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 0010000001000000200000020000003000000300000040000004000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)445373289.78846153846155257.0CPython 3.52550056244.59615384615387362.62549047025664Nuitka (master)2550056399.4038461538462362.62549047025664Nuitka (develop)2550056554.2115384615385362.62549047025664Nuitka (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
69 static PyCodeObject *codeobj_b07b9a939aa1ecd7a60b804324136b81; 69 static PyCodeObject *codeobj_b07b9a939aa1ecd7a60b804324136b81;
70 /* For use in "MainProgram.c". */ 70 /* For use in "MainProgram.c". */
71 PyCodeObject *codeobj_main = NULL; 71 PyCodeObject *codeobj_main = NULL;
72 72
73 static void createModuleCodeObjects(void) { 73 static void createModuleCodeObjects(void) {
n 74     module_filename_obj = mod_consts[3]; CHECK_OBJECT(module_filename_obj); n 74     module_filename_obj = mod_consts[2]; CHECK_OBJECT(module_filename_obj);
75     codeobj_8b166173857dda104a47a3da83fcd64f = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], NULL, NULL, 0, 0, 0); 75     codeobj_8b166173857dda104a47a3da83fcd64f = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[16], NULL, NULL, 0, 0, 0);
76     codeobj_b07b9a939aa1ecd7a60b804324136b81 = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], NULL, NULL, 0, 0, 0); 76     codeobj_b07b9a939aa1ecd7a60b804324136b81 = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], NULL, NULL, 0, 0, 0);
77 } 77 }
78 78
79 // The module function declarations. 79 // The module function declarations.
93     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; 93     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused;
94     PyObject *exception_type = NULL; 94     PyObject *exception_type = NULL;
95     PyObject *exception_value = NULL; 95     PyObject *exception_value = NULL;
96     PyTracebackObject *exception_tb = NULL; 96     PyTracebackObject *exception_tb = NULL;
97     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 97     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 98     static struct Nuitka_FrameObject *cache_frame_b07b9a939aa1ecd7a60b804324136b81 = NULL;
98     PyObject *tmp_return_value = NULL; 99     PyObject *tmp_return_value = NULL;
n 99     static struct Nuitka_FrameObject *cache_frame_b07b9a939aa1ecd7a60b804324136b81 = NULL; n
100 100
101     // Actual function body. 101     // Actual function body.
102     if (isFrameUnusable(cache_frame_b07b9a939aa1ecd7a60b804324136b81)) { 102     if (isFrameUnusable(cache_frame_b07b9a939aa1ecd7a60b804324136b81)) {
103         Py_XDECREF(cache_frame_b07b9a939aa1ecd7a60b804324136b81); 103         Py_XDECREF(cache_frame_b07b9a939aa1ecd7a60b804324136b81);
104 104
143             exception_lineno = 25; 143             exception_lineno = 25;
144 144
145             goto frame_exception_exit_1; 145             goto frame_exception_exit_1;
146         } 146         }
147     } 147     }
n 148     tmp_return_value = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[1]); n
149  
150     if (unlikely(tmp_return_value == NULL)) {
151         tmp_return_value = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[1]);
152     }
153  
154     if (tmp_return_value == NULL) {
155         assert(ERROR_OCCURRED());
156  
157         FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
158  
159  
160         exception_lineno = 27;
161  
162         goto frame_exception_exit_1;
163     }
164     Py_INCREF(tmp_return_value);
165     goto frame_return_exit_1;
166 148
167 #if 0 149 #if 0
168     RESTORE_FRAME_EXCEPTION(frame_b07b9a939aa1ecd7a60b804324136b81); 150     RESTORE_FRAME_EXCEPTION(frame_b07b9a939aa1ecd7a60b804324136b81);
169 #endif 151 #endif
170 152
171     // Put the previous frame back on top. 153     // Put the previous frame back on top.
172     popFrameStack(); 154     popFrameStack();
173 155
174     goto frame_no_exception_1; 156     goto frame_no_exception_1;
n 175   n
176     frame_return_exit_1:;
177 #if 0
178     RESTORE_FRAME_EXCEPTION(frame_b07b9a939aa1ecd7a60b804324136b81);
179 #endif
180  
181     // Put the previous frame back on top.
182     popFrameStack();
183  
184     goto function_return_exit;
185 157
186     frame_exception_exit_1:; 158     frame_exception_exit_1:;
187 159
188 #if 0 160 #if 0
189     RESTORE_FRAME_EXCEPTION(frame_b07b9a939aa1ecd7a60b804324136b81); 161     RESTORE_FRAME_EXCEPTION(frame_b07b9a939aa1ecd7a60b804324136b81);
220 192
221     // Return the error. 193     // Return the error.
222     goto function_exception_exit; 194     goto function_exception_exit;
223 195
224     frame_no_exception_1:; 196     frame_no_exception_1:;
n n 197     tmp_return_value = Py_None;
198     Py_INCREF(tmp_return_value);
199     goto function_return_exit;
225 200
226     NUITKA_CANNOT_GET_HERE("Return statement must have exited already."); 201     NUITKA_CANNOT_GET_HERE("Return statement must have exited already.");
227     return NULL; 202     return NULL;
228 203
229 function_exception_exit: 204 function_exception_exit:
656 631
657     // Module code. 632     // Module code.
658     { 633     {
659         PyObject *tmp_assign_source_1; 634         PyObject *tmp_assign_source_1;
660         tmp_assign_source_1 = Py_None; 635         tmp_assign_source_1 = Py_None;
n 661         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 636         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
662     } 637     }
663     { 638     {
664         PyObject *tmp_assign_source_2; 639         PyObject *tmp_assign_source_2;
n 665         tmp_assign_source_2 = mod_consts[3]; n 640         tmp_assign_source_2 = mod_consts[2];
666         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 641         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
667     } 642     }
668     { 643     {
669         PyObject *tmp_assign_source_3; 644         PyObject *tmp_assign_source_3;
670         tmp_assign_source_3 = Py_None; 645         tmp_assign_source_3 = Py_None;
n 671         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 646         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
672     } 647     }
673     { 648     {
674         PyObject *tmp_assign_source_4; 649         PyObject *tmp_assign_source_4;
n 675         tmp_assign_source_4 = mod_consts[6]; n 650         tmp_assign_source_4 = mod_consts[5];
676         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 651         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
677     } 652     }
678     { 653     {
679         PyObject *tmp_assign_source_5; 654         PyObject *tmp_assign_source_5;
t 680         tmp_assign_source_5 = mod_consts[7]; t 655         tmp_assign_source_5 = mod_consts[6];
681         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); 656         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_5);
682     } 657     }
683     { 658     {
684         PyObject *tmp_assign_source_6; 659         PyObject *tmp_assign_source_6;
685 660
686 661