Construct OperationAttributeLookup

Performance Diagrams

Construct OperationAttributeLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1492178073.61538461538461257.0CPython 2.710950529196.30769230769232322.7667663153612Nuitka (historic)9351284319.0000000000001349.2514111277918Nuitka (master)9350679441.69230769230774349.26143036193764Nuitka (develop)9351231564.3846153846155349.25228884582447Nuitka (factory)Construct OperationAttributeLookupTicks Construct OperationAttributeLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1591876273.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)10052251319.0000000000001348.0689614001004Nuitka (master)10057511441.69230769230774347.9873076306002Nuitka (develop)10111484564.3846153846155347.1494561284641Nuitka (factory)Construct OperationAttributeLookupTicks

Source Code with Construct

module_value1 = list()
module_value2 = 3000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
# construct_begin
    s.append
# construct_end

    return s, local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = list()
module_value2 = 3000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
# construct_begin



    return s, local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
27 27
28     local_value = module_value1 28     local_value = module_value1
29 29
30     s = module_value1 30     s = module_value1
31 # construct_begin 31 # construct_begin
t 32     s.append t 32  
33 # construct_end 33  
34 34
35     return s, local_value 35     return s, local_value
36 36
37 for x in xrange(50000): 37 for x in xrange(50000):
38     calledRepeatedly() 38     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
50 static PyObject *const_str_plain_x; 50 static PyObject *const_str_plain_x;
51 static PyObject *const_str_digest_7b2fdca7d6d4a90685d58bcfb8b8af4e; 51 static PyObject *const_str_digest_7b2fdca7d6d4a90685d58bcfb8b8af4e;
52 extern PyObject *const_tuple_empty; 52 extern PyObject *const_tuple_empty;
53 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 53 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
54 static PyObject *const_int_pos_3000; 54 static PyObject *const_int_pos_3000;
n 55 static PyObject *const_str_plain_append; n
56 extern PyObject *const_str_plain___loader__; 55 extern PyObject *const_str_plain___loader__;
57 extern PyObject *const_str_plain___main__; 56 extern PyObject *const_str_plain___main__;
58 extern PyObject *const_str_plain___doc__; 57 extern PyObject *const_str_plain___doc__;
59 extern PyObject *const_str_plain___cached__; 58 extern PyObject *const_str_plain___cached__;
60 static PyObject *module_filename_obj; 59 static PyObject *module_filename_obj;
79     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 ); 78     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 );
80     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 68 ], 8, 0 ); 79     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 68 ], 8, 0 );
81     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 76 ], 1, 1 ); 80     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 76 ], 1, 1 );
82     const_str_digest_7b2fdca7d6d4a90685d58bcfb8b8af4e = UNSTREAM_STRING( &constant_bin[ 77 ], 82, 0 ); 81     const_str_digest_7b2fdca7d6d4a90685d58bcfb8b8af4e = UNSTREAM_STRING( &constant_bin[ 77 ], 82, 0 );
83     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul ); 82     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul );
n 84     const_str_plain_append = UNSTREAM_STRING( &constant_bin[ 159 ], 6, 1 ); n
85 83
86     constants_created = true; 84     constants_created = true;
87 } 85 }
88 86
89 #ifndef __NUITKA_NO_ASSERT__ 87 #ifndef __NUITKA_NO_ASSERT__
133     PyTracebackObject *exception_keeper_tb_1; 131     PyTracebackObject *exception_keeper_tb_1;
134     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 132     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
135     PyObject *tmp_assign_source_1; 133     PyObject *tmp_assign_source_1;
136     PyObject *tmp_assign_source_2; 134     PyObject *tmp_assign_source_2;
137     PyObject *tmp_return_value; 135     PyObject *tmp_return_value;
n 138     PyObject *tmp_source_name_1; n
139     PyObject *tmp_tuple_element_1; 136     PyObject *tmp_tuple_element_1;
140     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
141     static struct Nuitka_FrameObject *cache_frame_function = NULL; 138     static struct Nuitka_FrameObject *cache_frame_function = NULL;
142 139
143     struct Nuitka_FrameObject *frame_function; 140     struct Nuitka_FrameObject *frame_function;
229 226
230     assert( var_s == NULL ); 227     assert( var_s == NULL );
231     Py_INCREF( tmp_assign_source_2 ); 228     Py_INCREF( tmp_assign_source_2 );
232     var_s = tmp_assign_source_2; 229     var_s = tmp_assign_source_2;
233 230
n 234     tmp_source_name_1 = var_s; n
235 231
n 236     tmp_unused = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append ); n 232 #if 0
237     if ( tmp_unused == NULL ) 233     RESTORE_FRAME_EXCEPTION( frame_function );
238     { 234 #endif
239         assert( ERROR_OCCURRED() );
240 235
n 241         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 236     // Put the previous frame back on top.
237     popFrameStack();
242 238
n n 239     goto frame_no_exception_1;
243 240
n 244         exception_lineno = 32; n
245         type_description = "oo";
246         goto frame_exception_exit_1; 241     frame_exception_exit_1:;
242  
243 #if 0
244     RESTORE_FRAME_EXCEPTION( frame_function );
245 #endif
246  
247     if ( exception_tb == NULL )
247     } 248     {
248     Py_DECREF( tmp_unused ); 249         exception_tb = MAKE_TRACEBACK( frame_function, exception_lineno );
250     }
251     else if ( exception_tb->tb_frame != &frame_function->m_frame )
252     {
253         exception_tb = ADD_TRACEBACK( exception_tb, frame_function, exception_lineno );
254     }
255  
256     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_function, type_description ,var_local_value, var_s );
257  
258     // Release cached frame.
259     if ( frame_function == cache_frame_function )
260     {
261         Py_DECREF( frame_function );
262     }
263     cache_frame_function = NULL;
264  
265     assertFrameObject( frame_function );
266  
267  
268     // Put the previous frame back on top.
269     popFrameStack();
270  
271     // Return the error.
272     goto try_except_handler_1;
273  
274     frame_no_exception_1:;
275  
249     tmp_return_value = PyTuple_New( 2 ); 276     tmp_return_value = PyTuple_New( 2 );
250     tmp_tuple_element_1 = var_s; 277     tmp_tuple_element_1 = var_s;
n 251   n
252     if ( tmp_tuple_element_1 == NULL )
253     {
254         Py_DECREF( tmp_return_value );
255         exception_type = PyExc_UnboundLocalError;
256         Py_INCREF( exception_type );
257         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
258         exception_tb = NULL;
259         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
260         CHAIN_EXCEPTION( exception_value );
261  
262         exception_lineno = 35;
263         type_description = "oo";
264         goto frame_exception_exit_1;
265     }
266 278
267     Py_INCREF( tmp_tuple_element_1 ); 279     Py_INCREF( tmp_tuple_element_1 );
268     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 280     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
269     tmp_tuple_element_1 = var_local_value; 281     tmp_tuple_element_1 = var_local_value;
270 282
n 271     if ( tmp_tuple_element_1 == NULL ) n
272     {
273         Py_DECREF( tmp_return_value );
274         exception_type = PyExc_UnboundLocalError;
275         Py_INCREF( exception_type );
276         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
277         exception_tb = NULL;
278         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
279         CHAIN_EXCEPTION( exception_value );
280  
281         exception_lineno = 35;
282         type_description = "oo";
283         goto frame_exception_exit_1;
284     }
285  
286     Py_INCREF( tmp_tuple_element_1 ); 283     Py_INCREF( tmp_tuple_element_1 );
287     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 284     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
n 288     goto frame_return_exit_1; n
289  
290 #if 0
291     RESTORE_FRAME_EXCEPTION( frame_function );
292 #endif
293  
294     // Put the previous frame back on top.
295     popFrameStack();
296  
297     goto frame_no_exception_1;
298  
299     frame_return_exit_1:;
300 #if 0
301     RESTORE_FRAME_EXCEPTION( frame_function );
302 #endif
303  
304     // Put the previous frame back on top.
305     popFrameStack();
306  
307     goto try_return_handler_1; 285     goto try_return_handler_1;
n 308   n
309     frame_exception_exit_1:;
310  
311 #if 0
312     RESTORE_FRAME_EXCEPTION( frame_function );
313 #endif
314  
315     if ( exception_tb == NULL )
316     {
317         exception_tb = MAKE_TRACEBACK( frame_function, exception_lineno );
318     }
319     else if ( exception_tb->tb_frame != &frame_function->m_frame )
320     {
321         exception_tb = ADD_TRACEBACK( exception_tb, frame_function, exception_lineno );
322     }
323  
324     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_function, type_description ,var_local_value, var_s );
325  
326     // Release cached frame.
327     if ( frame_function == cache_frame_function )
328     {
329         Py_DECREF( frame_function );
330     }
331     cache_frame_function = NULL;
332  
333     assertFrameObject( frame_function );
334  
335  
336     // Put the previous frame back on top.
337     popFrameStack();
338  
339     // Return the error.
340     goto try_except_handler_1;
341  
342     frame_no_exception_1:;
343  
344     // tried codes exits in all cases 286     // tried codes exits in all cases
345     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 287     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
346     return NULL; 288     return NULL;
347     // Return handler code: 289     // Return handler code:
348     try_return_handler_1:; 290     try_return_handler_1:;
n n 291     CHECK_OBJECT( (PyObject *)var_local_value );
349     Py_XDECREF( var_local_value ); 292     Py_DECREF( var_local_value );
350     var_local_value = NULL; 293     var_local_value = NULL;
351 294
352     Py_XDECREF( var_s ); 295     Py_XDECREF( var_s );
353     var_s = NULL; 296     var_s = NULL;
354 297
364     exception_tb = NULL; 307     exception_tb = NULL;
365     exception_lineno = -1; 308     exception_lineno = -1;
366 309
367     Py_XDECREF( var_local_value ); 310     Py_XDECREF( var_local_value );
368     var_local_value = NULL; 311     var_local_value = NULL;
t 369   t
370     Py_XDECREF( var_s );
371     var_s = NULL;
372 312
373     // Re-raise. 313     // Re-raise.
374     exception_type = exception_keeper_type_1; 314     exception_type = exception_keeper_type_1;
375     exception_value = exception_keeper_value_1; 315     exception_value = exception_keeper_value_1;
376     exception_tb = exception_keeper_tb_1; 316     exception_tb = exception_keeper_tb_1;