Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 0020000020000040000040000060000060000080000080000010000001000000120000012000001400000140000016000001600000180000018000002000000200000022000002200000240000024000002600000260000028000002800000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)280683774.3076923076923257.0CPython 2.71850268198.15384615384616341.21683066959497Nuitka (historic)1750117322.0350.0341766304097Nuitka (master)1749994445.8461538461538350.04500561417603Nuitka (develop)1750513569.6923076923077349.99931258511333Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 0010000001000000200000020000003000000300000040000004000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)415356674.3076923076923257.00000000000006CPython 3.50198.15384615384616504.11538461538464Nuitka (historic)2152662322.0376.04328991966463Nuitka (master)2140641445.8461538461538376.75847634946047Nuitka (develop)2160491569.6923076923077375.57750549583363Nuitka (factory)Construct GlobalVariableAccessTicks

Source Code with Construct

module_value1 = 1000
module_value2 = 2000

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



for x in xrange(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

for x in xrange(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 for x in xrange(50000): 32 for x in xrange(50000):
33     calledRepeatedly() 33     calledRepeatedly()
34 34
35 print("OK.") 35 print("OK.")

Context Diff of Generated Code


Construct
Baseline
157         exception_lineno = 25; 157         exception_lineno = 25;
158 158
159         goto frame_exception_exit_1; 159         goto frame_exception_exit_1;
160     } 160     }
161 161
n 162     tmp_return_value = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); n
163  
164     if (unlikely( tmp_return_value == NULL ))
165     {
166         tmp_return_value = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
167     }
168  
169     if ( tmp_return_value == NULL )
170     {
171  
172         exception_type = PyExc_NameError;
173         Py_INCREF( exception_type );
174         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
175         exception_tb = NULL;
176         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
177         CHAIN_EXCEPTION( exception_value );
178  
179         exception_lineno = 27;
180  
181         goto frame_exception_exit_1;
182     }
183  
184     Py_INCREF( tmp_return_value );
185     goto frame_return_exit_1;
186 162
187 #if 0 163 #if 0
188     RESTORE_FRAME_EXCEPTION( frame_function ); 164     RESTORE_FRAME_EXCEPTION( frame_function );
189 #endif 165 #endif
190 166
191     // Put the previous frame back on top. 167     // Put the previous frame back on top.
192     popFrameStack(); 168     popFrameStack();
193 169
194     goto frame_no_exception_1; 170     goto frame_no_exception_1;
195 171
n 196     frame_return_exit_1:; n 172     frame_exception_exit_1:;
173  
197 #if 0 174 #if 0
198     RESTORE_FRAME_EXCEPTION( frame_function ); 175     RESTORE_FRAME_EXCEPTION( frame_function );
199 #endif 176 #endif
200 177
n n 178     if ( exception_tb == NULL )
179     {
180         exception_tb = MAKE_TRACEBACK( frame_function, exception_lineno );
181     }
182     else if ( exception_tb->tb_frame != &frame_function->m_frame )
183     {
184         exception_tb = ADD_TRACEBACK( exception_tb, frame_function, exception_lineno );
185     }
186  
187     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_function, ""  );
188  
189     // Release cached frame.
190     if ( frame_function == cache_frame_function )
191     {
192         Py_DECREF( frame_function );
193     }
194     cache_frame_function = NULL;
195  
196     assertFrameObject( frame_function );
197  
198  
201     // Put the previous frame back on top. 199     // Put the previous frame back on top.
202     popFrameStack(); 200     popFrameStack();
203 201
n 204     goto function_return_exit; n
205  
206     frame_exception_exit_1:;
207  
208 #if 0
209     RESTORE_FRAME_EXCEPTION( frame_function );
210 #endif
211  
212     if ( exception_tb == NULL )
213     {
214         exception_tb = MAKE_TRACEBACK( frame_function, exception_lineno );
215     }
216     else if ( exception_tb->tb_frame != &frame_function->m_frame )
217     {
218         exception_tb = ADD_TRACEBACK( exception_tb, frame_function, exception_lineno );
219     }
220  
221     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_function, ""  );
222  
223     // Release cached frame.
224     if ( frame_function == cache_frame_function )
225     {
226         Py_DECREF( frame_function );
227     }
228     cache_frame_function = NULL;
229  
230     assertFrameObject( frame_function );
231  
232  
233     // Put the previous frame back on top.
234     popFrameStack();
235  
236     // Return the error. 202     // Return the error.
237     goto function_exception_exit; 203     goto function_exception_exit;
238 204
239     frame_no_exception_1:; 205     frame_no_exception_1:;
240 206
t t 207     tmp_return_value = Py_None;
208     Py_INCREF( tmp_return_value );
209     goto function_return_exit;
241 210
242     // Return statement must have exited already. 211     // Return statement must have exited already.
243     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 212     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
244     return NULL; 213     return NULL;
245 214