Construct OperationAttributeLookup

Performance Diagrams

Construct OperationAttributeLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1492178073.61538461538461257.0CPython 2.710950529196.30769230769232322.7667663153612Nuitka (historic)9351300319.0000000000001349.2511461563103Nuitka (master)9351799441.69230769230774349.24288235822974Nuitka (develop)9351799564.3846153846155349.24288235822974Nuitka (factory)Construct OperationAttributeLookupTicks Construct OperationAttributeLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1591876273.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)10115308319.0000000000001347.0900941485081Nuitka (master)10109562441.69230769230774347.1792923537454Nuitka (develop)10109175564.3846153846155347.1852999599805Nuitka (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 extern PyObject *const_tuple_empty; 51 extern PyObject *const_tuple_empty;
52 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 52 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
53 static PyObject *const_str_digest_7609186ff1600c25fa4bd562a955f4e9; 53 static PyObject *const_str_digest_7609186ff1600c25fa4bd562a955f4e9;
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___main__; 55 extern PyObject *const_str_plain___main__;
57 extern PyObject *const_str_plain___doc__; 56 extern PyObject *const_str_plain___doc__;
58 extern PyObject *const_str_plain___cached__; 57 extern PyObject *const_str_plain___cached__;
59 static PyObject *module_filename_obj; 58 static PyObject *module_filename_obj;
60 59
78     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 ); 77     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 );
79     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 68 ], 8, 0 ); 78     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 68 ], 8, 0 );
80     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 76 ], 1, 1 ); 79     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 76 ], 1, 1 );
81     const_str_digest_7609186ff1600c25fa4bd562a955f4e9 = UNSTREAM_STRING( &constant_bin[ 77 ], 82, 0 ); 80     const_str_digest_7609186ff1600c25fa4bd562a955f4e9 = UNSTREAM_STRING( &constant_bin[ 77 ], 82, 0 );
82     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul ); 81     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul );
n 83     const_str_plain_append = UNSTREAM_STRING( &constant_bin[ 159 ], 6, 1 ); n
84 82
85     constants_created = true; 83     constants_created = true;
86 } 84 }
87 85
88 #ifndef __NUITKA_NO_ASSERT__ 86 #ifndef __NUITKA_NO_ASSERT__
132     PyTracebackObject *exception_keeper_tb_1; 130     PyTracebackObject *exception_keeper_tb_1;
133     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 131     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
134     PyObject *tmp_assign_source_1; 132     PyObject *tmp_assign_source_1;
135     PyObject *tmp_assign_source_2; 133     PyObject *tmp_assign_source_2;
136     PyObject *tmp_return_value; 134     PyObject *tmp_return_value;
n 137     PyObject *tmp_source_name_1; n
138     PyObject *tmp_tuple_element_1; 135     PyObject *tmp_tuple_element_1;
139     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 136     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
140     static struct Nuitka_FrameObject *cache_frame_3f481d8c393477c9337479ea432531fd = NULL; 137     static struct Nuitka_FrameObject *cache_frame_3f481d8c393477c9337479ea432531fd = NULL;
141 138
142     struct Nuitka_FrameObject *frame_3f481d8c393477c9337479ea432531fd; 139     struct Nuitka_FrameObject *frame_3f481d8c393477c9337479ea432531fd;
228 225
229     assert( var_s == NULL ); 226     assert( var_s == NULL );
230     Py_INCREF( tmp_assign_source_2 ); 227     Py_INCREF( tmp_assign_source_2 );
231     var_s = tmp_assign_source_2; 228     var_s = tmp_assign_source_2;
232 229
n 233     tmp_source_name_1 = var_s; n
234 230
n 235     CHECK_OBJECT( tmp_source_name_1 ); n 231 #if 0
236     tmp_unused = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append ); 232     RESTORE_FRAME_EXCEPTION( frame_3f481d8c393477c9337479ea432531fd );
237     if ( tmp_unused == NULL ) 233 #endif
238     {
239         assert( ERROR_OCCURRED() );
240 234
n 241         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 235     // Put the previous frame back on top.
236     popFrameStack();
242 237
n n 238     goto frame_no_exception_1;
243 239
n 244         exception_lineno = 32; n
245         type_description = "oo";
246         goto frame_exception_exit_1; 240     frame_exception_exit_1:;
241  
242 #if 0
243     RESTORE_FRAME_EXCEPTION( frame_3f481d8c393477c9337479ea432531fd );
244 #endif
245  
246     if ( exception_tb == NULL )
247     } 247     {
248     Py_DECREF( tmp_unused ); 248         exception_tb = MAKE_TRACEBACK( frame_3f481d8c393477c9337479ea432531fd, exception_lineno );
249     }
250     else if ( exception_tb->tb_frame != &frame_3f481d8c393477c9337479ea432531fd->m_frame )
251     {
252         exception_tb = ADD_TRACEBACK( exception_tb, frame_3f481d8c393477c9337479ea432531fd, exception_lineno );
253     }
254  
255     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_3f481d8c393477c9337479ea432531fd, type_description ,var_local_value, var_s );
256  
257     // Release cached frame.
258     if ( frame_3f481d8c393477c9337479ea432531fd == cache_frame_3f481d8c393477c9337479ea432531fd )
259     {
260         Py_DECREF( frame_3f481d8c393477c9337479ea432531fd );
261     }
262     cache_frame_3f481d8c393477c9337479ea432531fd = NULL;
263  
264     assertFrameObject( frame_3f481d8c393477c9337479ea432531fd );
265  
266  
267     // Put the previous frame back on top.
268     popFrameStack();
269  
270     // Return the error.
271     goto try_except_handler_1;
272  
273     frame_no_exception_1:;
274  
249     tmp_return_value = PyTuple_New( 2 ); 275     tmp_return_value = PyTuple_New( 2 );
250     tmp_tuple_element_1 = var_s; 276     tmp_tuple_element_1 = var_s;
251 277
n 252     if ( tmp_tuple_element_1 == NULL ) n 278     CHECK_OBJECT( tmp_tuple_element_1 );
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  
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 283     CHECK_OBJECT( tmp_tuple_element_1 );
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 ); 284     Py_INCREF( tmp_tuple_element_1 );
287     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 285     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_3f481d8c393477c9337479ea432531fd );
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_3f481d8c393477c9337479ea432531fd );
302 #endif
303  
304     // Put the previous frame back on top.
305     popFrameStack();
306  
307     goto try_return_handler_1; 286     goto try_return_handler_1;
n 308   n
309     frame_exception_exit_1:;
310  
311 #if 0
312     RESTORE_FRAME_EXCEPTION( frame_3f481d8c393477c9337479ea432531fd );
313 #endif
314  
315     if ( exception_tb == NULL )
316     {
317         exception_tb = MAKE_TRACEBACK( frame_3f481d8c393477c9337479ea432531fd, exception_lineno );
318     }
319     else if ( exception_tb->tb_frame != &frame_3f481d8c393477c9337479ea432531fd->m_frame )
320     {
321         exception_tb = ADD_TRACEBACK( exception_tb, frame_3f481d8c393477c9337479ea432531fd, exception_lineno );
322     }
323  
324     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_3f481d8c393477c9337479ea432531fd, type_description ,var_local_value, var_s );
325  
326     // Release cached frame.
327     if ( frame_3f481d8c393477c9337479ea432531fd == cache_frame_3f481d8c393477c9337479ea432531fd )
328     {
329         Py_DECREF( frame_3f481d8c393477c9337479ea432531fd );
330     }
331     cache_frame_3f481d8c393477c9337479ea432531fd = NULL;
332  
333     assertFrameObject( frame_3f481d8c393477c9337479ea432531fd );
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 287     // tried codes exits in all cases
345     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 288     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
346     return NULL; 289     return NULL;
347     // Return handler code: 290     // Return handler code:
348     try_return_handler_1:; 291     try_return_handler_1:;
n n 292     CHECK_OBJECT( (PyObject *)var_local_value );
349     Py_XDECREF( var_local_value ); 293     Py_DECREF( var_local_value );
350     var_local_value = NULL; 294     var_local_value = NULL;
351 295
352     Py_XDECREF( var_s ); 296     Py_XDECREF( var_s );
353     var_s = NULL; 297     var_s = NULL;
354 298
364     exception_tb = NULL; 308     exception_tb = NULL;
365     exception_lineno = -1; 309     exception_lineno = -1;
366 310
367     Py_XDECREF( var_local_value ); 311     Py_XDECREF( var_local_value );
368     var_local_value = NULL; 312     var_local_value = NULL;
t 369   t
370     Py_XDECREF( var_s );
371     var_s = NULL;
372 313
373     // Re-raise. 314     // Re-raise.
374     exception_type = exception_keeper_type_1; 315     exception_type = exception_keeper_type_1;
375     exception_value = exception_keeper_value_1; 316     exception_value = exception_keeper_value_1;
376     exception_tb = exception_keeper_tb_1; 317     exception_tb = exception_keeper_tb_1;