Construct GlobalVariableAccess

Performance Diagrams

Construct GlobalVariableAccess 0020000020000040000040000060000060000080000080000010000001000000120000012000001400000140000016000001600000180000018000002000000200000022000002200000240000024000002600000260000028000002800000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)280683774.3076923076923257.0CPython 2.71850268198.15384615384616341.21683066959497Nuitka (historic)1750000322.0350.04447737106545Nuitka (master)1750117445.8461538461538350.0341766304097Nuitka (develop)1750111569.6923076923077350.03470487352024Nuitka (factory)Construct GlobalVariableAccessTicks Construct GlobalVariableAccess 0010000001000000200000020000003000000300000040000004000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)415356674.3076923076923257.00000000000006CPython 3.50198.15384615384616504.11538461538464Nuitka (historic)2132779322.0377.2262241001514Nuitka (master)2151555445.8461538461538376.1091506116024Nuitka (develop)2155310569.6923076923077375.88574781284325Nuitka (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
162 162
163         exception_lineno = 25; 163         exception_lineno = 25;
164         goto frame_exception_exit_1; 164         goto frame_exception_exit_1;
165     } 165     }
166 166
n 167     tmp_return_value = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); n
168  
169     if (unlikely( tmp_return_value == NULL ))
170     {
171         tmp_return_value = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
172     }
173  
174     if ( tmp_return_value == NULL )
175     {
176  
177         exception_type = PyExc_NameError;
178         Py_INCREF( exception_type );
179         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
180         exception_tb = NULL;
181         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
182         CHAIN_EXCEPTION( exception_value );
183  
184         exception_lineno = 27;
185         goto frame_exception_exit_1;
186     }
187  
188     Py_INCREF( tmp_return_value );
189     goto frame_return_exit_1;
190 167
191 #if 0 168 #if 0
192     RESTORE_FRAME_EXCEPTION( frame_function ); 169     RESTORE_FRAME_EXCEPTION( frame_function );
193 #endif 170 #endif
194     // Put the previous frame back on top. 171     // Put the previous frame back on top.
196 #if PYTHON_VERSION >= 340 173 #if PYTHON_VERSION >= 340
197     frame_function->f_executing -= 1; 174     frame_function->f_executing -= 1;
198 #endif 175 #endif
199     Py_DECREF( frame_function ); 176     Py_DECREF( frame_function );
200     goto frame_no_exception_1; 177     goto frame_no_exception_1;
n 201   n
202     frame_return_exit_1:;
203 #if 0
204     RESTORE_FRAME_EXCEPTION( frame_function );
205 #endif
206     popFrameStack();
207 #if PYTHON_VERSION >= 340
208     frame_function->f_executing -= 1;
209 #endif
210     Py_DECREF( frame_function );
211     goto function_return_exit;
212 178
213     frame_exception_exit_1:; 179     frame_exception_exit_1:;
214 #if 0 180 #if 0
215     RESTORE_FRAME_EXCEPTION( frame_function ); 181     RESTORE_FRAME_EXCEPTION( frame_function );
216 #endif 182 #endif
252     // Return the error. 218     // Return the error.
253     goto function_exception_exit; 219     goto function_exception_exit;
254 220
255     frame_no_exception_1:; 221     frame_no_exception_1:;
256 222
t t 223     tmp_return_value = Py_None;
224     Py_INCREF( tmp_return_value );
225     goto function_return_exit;
257 226
258     // Return statement must have exited already. 227     // Return statement must have exited already.
259     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 228     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
260     return NULL; 229     return NULL;
261 230