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)9351290441.69230769230774349.2513117634862Nuitka (develop)9350499564.3846153846155349.26441129110503Nuitka (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)10051721441.69230769230774348.07718887117176Nuitka (develop)10057429564.3846153846155347.9885805600867Nuitka (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_angle_module; 50 static PyObject *const_str_angle_module;
51 static PyObject *const_str_plain_x; 51 static PyObject *const_str_plain_x;
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_module_value1 = UNSTREAM_STRING( &constant_bin[ 121 ], 13, 1 ); 78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 121 ], 13, 1 );
80     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 134 ], 16, 1 ); 79     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 134 ], 16, 1 );
81     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 150 ], 8, 0 ); 80     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 150 ], 8, 0 );
82     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 37 ], 1, 1 ); 81     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 37 ], 1, 1 );
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[ 158 ], 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__
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_frame_locals; 135     PyObject *tmp_frame_locals;
138     PyObject *tmp_return_value; 136     PyObject *tmp_return_value;
n 139     PyObject *tmp_source_name_1; n
140     PyObject *tmp_tuple_element_1; 137     PyObject *tmp_tuple_element_1;
141     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 138     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
142     static PyFrameObject *cache_frame_function = NULL; 139     static PyFrameObject *cache_frame_function = NULL;
143 140
144     PyFrameObject *frame_function; 141     PyFrameObject *frame_function;
231 228
232     assert( var_s == NULL ); 229     assert( var_s == NULL );
233     Py_INCREF( tmp_assign_source_2 ); 230     Py_INCREF( tmp_assign_source_2 );
234     var_s = tmp_assign_source_2; 231     var_s = tmp_assign_source_2;
235 232
n 236     tmp_source_name_1 = var_s; n
237  
238     tmp_unused = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append );
239     if ( tmp_unused == NULL )
240     {
241         assert( ERROR_OCCURRED() );
242  
243         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
244  
245  
246         exception_lineno = 32;
247         goto frame_exception_exit_1;
248     }
249     Py_DECREF( tmp_unused );
250     tmp_return_value = PyTuple_New( 2 );
251     tmp_tuple_element_1 = var_s;
252  
253     if ( tmp_tuple_element_1 == NULL )
254     {
255         Py_DECREF( tmp_return_value );
256         exception_type = PyExc_UnboundLocalError;
257         Py_INCREF( exception_type );
258         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
259         exception_tb = NULL;
260         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
261         CHAIN_EXCEPTION( exception_value );
262  
263         exception_lineno = 35;
264         goto frame_exception_exit_1;
265     }
266  
267     Py_INCREF( tmp_tuple_element_1 );
268     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
269     tmp_tuple_element_1 = var_local_value;
270  
271     if ( tmp_tuple_element_1 == NULL )
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         goto frame_exception_exit_1;
283     }
284  
285     Py_INCREF( tmp_tuple_element_1 );
286     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
287     goto frame_return_exit_1;
288 233
289 #if 0 234 #if 0
290     RESTORE_FRAME_EXCEPTION( frame_function ); 235     RESTORE_FRAME_EXCEPTION( frame_function );
291 #endif 236 #endif
292     // Put the previous frame back on top. 237     // Put the previous frame back on top.
294 #if PYTHON_VERSION >= 340 239 #if PYTHON_VERSION >= 340
295     frame_function->f_executing -= 1; 240     frame_function->f_executing -= 1;
296 #endif 241 #endif
297     Py_DECREF( frame_function ); 242     Py_DECREF( frame_function );
298     goto frame_no_exception_1; 243     goto frame_no_exception_1;
n 299   n
300     frame_return_exit_1:;
301 #if 0
302     RESTORE_FRAME_EXCEPTION( frame_function );
303 #endif
304     popFrameStack();
305 #if PYTHON_VERSION >= 340
306     frame_function->f_executing -= 1;
307 #endif
308     Py_DECREF( frame_function );
309     goto try_return_handler_1;
310 244
311     frame_exception_exit_1:; 245     frame_exception_exit_1:;
312 #if 0 246 #if 0
313     RESTORE_FRAME_EXCEPTION( frame_function ); 247     RESTORE_FRAME_EXCEPTION( frame_function );
314 #endif 248 #endif
372     // Return the error. 306     // Return the error.
373     goto try_except_handler_1; 307     goto try_except_handler_1;
374 308
375     frame_no_exception_1:; 309     frame_no_exception_1:;
376 310
n n 311     tmp_return_value = PyTuple_New( 2 );
312     tmp_tuple_element_1 = var_s;
313  
314     Py_INCREF( tmp_tuple_element_1 );
315     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
316     tmp_tuple_element_1 = var_local_value;
317  
318     Py_INCREF( tmp_tuple_element_1 );
319     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
320     goto try_return_handler_1;
377     // tried codes exits in all cases 321     // tried codes exits in all cases
378     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 322     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
379     return NULL; 323     return NULL;
380     // Return handler code: 324     // Return handler code:
381     try_return_handler_1:; 325     try_return_handler_1:;
n n 326     CHECK_OBJECT( (PyObject *)var_local_value );
382     Py_XDECREF( var_local_value ); 327     Py_DECREF( var_local_value );
383     var_local_value = NULL; 328     var_local_value = NULL;
384 329
385     Py_XDECREF( var_s ); 330     Py_XDECREF( var_s );
386     var_s = NULL; 331     var_s = NULL;
387 332
397     exception_tb = NULL; 342     exception_tb = NULL;
398     exception_lineno = -1; 343     exception_lineno = -1;
399 344
400     Py_XDECREF( var_local_value ); 345     Py_XDECREF( var_local_value );
401     var_local_value = NULL; 346     var_local_value = NULL;
t 402   t
403     Py_XDECREF( var_s );
404     var_s = NULL;
405 347
406     // Re-raise. 348     // Re-raise.
407     exception_type = exception_keeper_type_1; 349     exception_type = exception_keeper_type_1;
408     exception_value = exception_keeper_value_1; 350     exception_value = exception_keeper_value_1;
409     exception_tb = exception_keeper_tb_1; 351     exception_tb = exception_keeper_tb_1;