Construct GlobalVariableAccess

Performance Diagrams

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