Construct OperationAttributeLookup

Performance Diagrams

Construct OperationAttributeLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1492174188.95192307692307257.0CPython 2.79301415242.31730769230768350.0768749540584Nuitka (master)9301085395.6826923076923350.0823400051488Nuitka (develop)9300959549.0480769230769350.08442666101973Nuitka (factory)Construct OperationAttributeLookupTicks Construct OperationAttributeLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1591797088.95192307692307257.0CPython 3.510105893242.31730769230768347.22844265124456Nuitka (master)10097463395.6826923076923347.35931252298747Nuitka (develop)10098149549.0480769230769347.3486628513367Nuitka (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

import itertools
for x in itertools.repeat(None, 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

import itertools
for x in itertools.repeat(None, 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 import itertools 37 import itertools
38 for x in itertools.repeat(None, 50000): 38 for x in itertools.repeat(None, 50000):

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_plain_repeat; 53 static PyObject *const_str_plain_repeat;
54 static PyObject *const_int_pos_3000; 54 static PyObject *const_int_pos_3000;
n 55 static PyObject *const_str_plain_append; n
56 static PyObject *const_str_digest_8a164316f68750877560f79d3e76ec19; 55 static PyObject *const_str_digest_8a164316f68750877560f79d3e76ec19;
57 static PyObject *const_tuple_none_int_pos_50000_tuple; 56 static PyObject *const_tuple_none_int_pos_50000_tuple;
58 extern PyObject *const_str_plain___loader__; 57 extern PyObject *const_str_plain___loader__;
59 extern PyObject *const_str_plain___main__; 58 extern PyObject *const_str_plain___main__;
60 extern PyObject *const_str_plain___doc__; 59 extern PyObject *const_str_plain___doc__;
82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 68 ], 16, 1 ); 81     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 68 ], 16, 1 );
83     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 84 ], 8, 0 ); 82     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 84 ], 8, 0 );
84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 92 ], 1, 1 ); 83     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 92 ], 1, 1 );
85     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 93 ], 6, 1 ); 84     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 93 ], 6, 1 );
86     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul ); 85     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul );
n 87     const_str_plain_append = UNSTREAM_STRING( &constant_bin[ 99 ], 6, 1 ); n
88     const_str_digest_8a164316f68750877560f79d3e76ec19 = UNSTREAM_STRING( &constant_bin[ 105 ], 82, 0 ); 86     const_str_digest_8a164316f68750877560f79d3e76ec19 = UNSTREAM_STRING( &constant_bin[ 99 ], 82, 0 );
89     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 87     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
90     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 88     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
91     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 89     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
92 90
93     constants_created = true; 91     constants_created = true;
141     PyTracebackObject *exception_keeper_tb_1; 139     PyTracebackObject *exception_keeper_tb_1;
142     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 140     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
143     PyObject *tmp_assign_source_1; 141     PyObject *tmp_assign_source_1;
144     PyObject *tmp_assign_source_2; 142     PyObject *tmp_assign_source_2;
145     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
n 146     PyObject *tmp_source_name_1; n
147     PyObject *tmp_tuple_element_1; 144     PyObject *tmp_tuple_element_1;
148     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 145     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
149     static struct Nuitka_FrameObject *cache_frame_12d30816a2b91a78e2a32429c516170b = NULL; 146     static struct Nuitka_FrameObject *cache_frame_12d30816a2b91a78e2a32429c516170b = NULL;
150 147
151     struct Nuitka_FrameObject *frame_12d30816a2b91a78e2a32429c516170b; 148     struct Nuitka_FrameObject *frame_12d30816a2b91a78e2a32429c516170b;
237 234
238     assert( var_s == NULL ); 235     assert( var_s == NULL );
239     Py_INCREF( tmp_assign_source_2 ); 236     Py_INCREF( tmp_assign_source_2 );
240     var_s = tmp_assign_source_2; 237     var_s = tmp_assign_source_2;
241 238
n 242     tmp_source_name_1 = var_s; n
243  
244     CHECK_OBJECT( tmp_source_name_1 );
245     tmp_unused = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append );
246     if ( tmp_unused == NULL )
247     {
248         assert( ERROR_OCCURRED() );
249  
250         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
251  
252  
253         exception_lineno = 32;
254         type_description_1 = "oo";
255         goto frame_exception_exit_1;
256     }
257     Py_DECREF( tmp_unused );
258     tmp_return_value = PyTuple_New( 2 );
259     tmp_tuple_element_1 = var_s;
260  
261     if ( tmp_tuple_element_1 == NULL )
262     {
263         Py_DECREF( tmp_return_value );
264         exception_type = PyExc_UnboundLocalError;
265         Py_INCREF( exception_type );
266         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
267         exception_tb = NULL;
268         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
269         CHAIN_EXCEPTION( exception_value );
270  
271         exception_lineno = 35;
272         type_description_1 = "oo";
273         goto frame_exception_exit_1;
274     }
275  
276     Py_INCREF( tmp_tuple_element_1 );
277     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
278     tmp_tuple_element_1 = var_local_value;
279  
280     if ( tmp_tuple_element_1 == NULL )
281     {
282         Py_DECREF( tmp_return_value );
283         exception_type = PyExc_UnboundLocalError;
284         Py_INCREF( exception_type );
285         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
286         exception_tb = NULL;
287         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
288         CHAIN_EXCEPTION( exception_value );
289  
290         exception_lineno = 35;
291         type_description_1 = "oo";
292         goto frame_exception_exit_1;
293     }
294  
295     Py_INCREF( tmp_tuple_element_1 );
296     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
297     goto frame_return_exit_1;
298 239
299 #if 0 240 #if 0
300     RESTORE_FRAME_EXCEPTION( frame_12d30816a2b91a78e2a32429c516170b ); 241     RESTORE_FRAME_EXCEPTION( frame_12d30816a2b91a78e2a32429c516170b );
301 #endif 242 #endif
302 243
303     // Put the previous frame back on top. 244     // Put the previous frame back on top.
304     popFrameStack(); 245     popFrameStack();
305 246
306     goto frame_no_exception_1; 247     goto frame_no_exception_1;
n 307   n
308     frame_return_exit_1:;
309 #if 0
310     RESTORE_FRAME_EXCEPTION( frame_12d30816a2b91a78e2a32429c516170b );
311 #endif
312  
313     // Put the previous frame back on top.
314     popFrameStack();
315  
316     goto try_return_handler_1;
317 248
318     frame_exception_exit_1:; 249     frame_exception_exit_1:;
319 250
320 #if 0 251 #if 0
321     RESTORE_FRAME_EXCEPTION( frame_12d30816a2b91a78e2a32429c516170b ); 252     RESTORE_FRAME_EXCEPTION( frame_12d30816a2b91a78e2a32429c516170b );
354     // Return the error. 285     // Return the error.
355     goto try_except_handler_1; 286     goto try_except_handler_1;
356 287
357     frame_no_exception_1:; 288     frame_no_exception_1:;
358 289
n n 290     tmp_return_value = PyTuple_New( 2 );
291     tmp_tuple_element_1 = var_s;
292  
293     CHECK_OBJECT( tmp_tuple_element_1 );
294     Py_INCREF( tmp_tuple_element_1 );
295     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
296     tmp_tuple_element_1 = var_local_value;
297  
298     CHECK_OBJECT( tmp_tuple_element_1 );
299     Py_INCREF( tmp_tuple_element_1 );
300     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
301     goto try_return_handler_1;
359     // tried codes exits in all cases 302     // tried codes exits in all cases
360     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 303     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
361     return NULL; 304     return NULL;
362     // Return handler code: 305     // Return handler code:
363     try_return_handler_1:; 306     try_return_handler_1:;
n n 307     CHECK_OBJECT( (PyObject *)var_local_value );
364     Py_XDECREF( var_local_value ); 308     Py_DECREF( var_local_value );
365     var_local_value = NULL; 309     var_local_value = NULL;
366 310
367     Py_XDECREF( var_s ); 311     Py_XDECREF( var_s );
368     var_s = NULL; 312     var_s = NULL;
369 313
379     exception_tb = NULL; 323     exception_tb = NULL;
380     exception_lineno = 0; 324     exception_lineno = 0;
381 325
382     Py_XDECREF( var_local_value ); 326     Py_XDECREF( var_local_value );
383     var_local_value = NULL; 327     var_local_value = NULL;
t 384   t
385     Py_XDECREF( var_s );
386     var_s = NULL;
387 328
388     // Re-raise. 329     // Re-raise.
389     exception_type = exception_keeper_type_1; 330     exception_type = exception_keeper_type_1;
390     exception_value = exception_keeper_value_1; 331     exception_value = exception_keeper_value_1;
391     exception_tb = exception_keeper_tb_1; 332     exception_tb = exception_keeper_tb_1;