Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 002000002000004000004000006000006000008000008000001000000100000012000001200000140000014000001600000160000018000001800000200000020000002200000220000024000002400000260000026000002800000280000030000003000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)316247789.78846153846155257.0CPython 2.71799988244.59615384615387363.4646456778123Nuitka (master)1799970399.4038461538462363.4660521945784Nuitka (develop)1799970554.2115384615385363.4660521945784Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 00400000400000800000800000120000012000001600000160000020000002000000240000024000002800000280000032000003200000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)355273989.78846153846155257.0CPython 3.52249420244.59615384615387347.65404916081326Nuitka (master)2243644399.4038461538462348.0558063575954Nuitka (develop)2258556554.2115384615385347.0185827913878Nuitka (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
166         exception_lineno = 25; 166         exception_lineno = 25;
167 167
168         goto frame_exception_exit_1; 168         goto frame_exception_exit_1;
169     } 169     }
170 170
n 171     tmp_return_value = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); n
172  
173     if (unlikely( tmp_return_value == NULL ))
174     {
175         tmp_return_value = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
176     }
177  
178     if ( tmp_return_value == NULL )
179     {
180  
181         exception_type = PyExc_NameError;
182         Py_INCREF( exception_type );
183         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
184         exception_tb = NULL;
185         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
186         CHAIN_EXCEPTION( exception_value );
187  
188         exception_lineno = 27;
189  
190         goto frame_exception_exit_1;
191     }
192  
193     Py_INCREF( tmp_return_value );
194     goto frame_return_exit_1;
195 171
196 #if 0 172 #if 0
197     RESTORE_FRAME_EXCEPTION( frame_fd03056961d50e6253dfbee3e5eac7df ); 173     RESTORE_FRAME_EXCEPTION( frame_fd03056961d50e6253dfbee3e5eac7df );
198 #endif 174 #endif
199 175
200     // Put the previous frame back on top. 176     // Put the previous frame back on top.
201     popFrameStack(); 177     popFrameStack();
202 178
203     goto frame_no_exception_1; 179     goto frame_no_exception_1;
n 204   n
205     frame_return_exit_1:;
206 #if 0
207     RESTORE_FRAME_EXCEPTION( frame_fd03056961d50e6253dfbee3e5eac7df );
208 #endif
209  
210     // Put the previous frame back on top.
211     popFrameStack();
212  
213     goto function_return_exit;
214 180
215     frame_exception_exit_1:; 181     frame_exception_exit_1:;
216 182
217 #if 0 183 #if 0
218     RESTORE_FRAME_EXCEPTION( frame_fd03056961d50e6253dfbee3e5eac7df ); 184     RESTORE_FRAME_EXCEPTION( frame_fd03056961d50e6253dfbee3e5eac7df );
249     // Return the error. 215     // Return the error.
250     goto function_exception_exit; 216     goto function_exception_exit;
251 217
252     frame_no_exception_1:; 218     frame_no_exception_1:;
253 219
t t 220     tmp_return_value = Py_None;
221     Py_INCREF( tmp_return_value );
222     goto function_return_exit;
254 223
255     // Return statement must have exited already. 224     // Return statement must have exited already.
256     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 225     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
257     return NULL; 226     return NULL;
258 227