Construct OperationAttributeLookup

Performance Diagrams

Construct OperationAttributeLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1492174188.95192307692307257.0CPython 2.79301316242.31730769230768350.0785144693855Nuitka (master)9301325395.6826923076923350.07836542253756Nuitka (develop)9301325549.0480769230769350.07836542253756Nuitka (factory)Construct OperationAttributeLookupTicks Construct OperationAttributeLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1591797088.95192307692307257.0CPython 3.510105359242.31730769230768347.2367326288852Nuitka (master)10097710395.6826923076923347.3554780202211Nuitka (develop)10096742549.0480769230769347.3705055452326Nuitka (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
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_str_plain_repeat; 54 static PyObject *const_str_plain_repeat;
55 static PyObject *const_int_pos_3000; 55 static PyObject *const_int_pos_3000;
n 56 static PyObject *const_str_plain_append; n
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__;
61 extern PyObject *const_str_plain___cached__; 60 extern PyObject *const_str_plain___cached__;
83     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 ); 82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 );
84     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 166 ], 8, 0 ); 83     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 166 ], 8, 0 );
85     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 64 ], 1, 1 ); 84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 64 ], 1, 1 );
86     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 174 ], 6, 1 ); 85     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 174 ], 6, 1 );
87     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul ); 86     const_int_pos_3000 = PyLong_FromUnsignedLong( 3000ul );
n 88     const_str_plain_append = UNSTREAM_STRING( &constant_bin[ 180 ], 6, 1 ); n
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_e01eaa42ff4fd24fd9d7f5a030f711ac = NULL; 146     static struct Nuitka_FrameObject *cache_frame_e01eaa42ff4fd24fd9d7f5a030f711ac = NULL;
150 147
151     struct Nuitka_FrameObject *frame_e01eaa42ff4fd24fd9d7f5a030f711ac; 148     struct Nuitka_FrameObject *frame_e01eaa42ff4fd24fd9d7f5a030f711ac;
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 239
n 244     CHECK_OBJECT( tmp_source_name_1 ); n 240 #if 0
245     tmp_unused = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append ); 241     RESTORE_FRAME_EXCEPTION( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
246     if ( tmp_unused == NULL ) 242 #endif
247     {
248         assert( ERROR_OCCURRED() );
249 243
n 250         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 244     // Put the previous frame back on top.
245     popFrameStack();
251 246
n n 247     goto frame_no_exception_1;
252 248
n 253         exception_lineno = 32; n
254         type_description = "oo";
255         goto frame_exception_exit_1; 249     frame_exception_exit_1:;
250  
251 #if 0
252     RESTORE_FRAME_EXCEPTION( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
253 #endif
254  
255     if ( exception_tb == NULL )
256     } 256     {
257     Py_DECREF( tmp_unused ); 257         exception_tb = MAKE_TRACEBACK( frame_e01eaa42ff4fd24fd9d7f5a030f711ac, exception_lineno );
258     }
259     else if ( exception_tb->tb_frame != &frame_e01eaa42ff4fd24fd9d7f5a030f711ac->m_frame )
260     {
261         exception_tb = ADD_TRACEBACK( exception_tb, frame_e01eaa42ff4fd24fd9d7f5a030f711ac, exception_lineno );
262     }
263  
264     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_e01eaa42ff4fd24fd9d7f5a030f711ac, type_description ,var_local_value, var_s );
265  
266     // Release cached frame.
267     if ( frame_e01eaa42ff4fd24fd9d7f5a030f711ac == cache_frame_e01eaa42ff4fd24fd9d7f5a030f711ac )
268     {
269         Py_DECREF( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
270     }
271     cache_frame_e01eaa42ff4fd24fd9d7f5a030f711ac = NULL;
272  
273     assertFrameObject( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
274  
275  
276     // Put the previous frame back on top.
277     popFrameStack();
278  
279     // Return the error.
280     goto try_except_handler_1;
281  
282     frame_no_exception_1:;
283  
258     tmp_return_value = PyTuple_New( 2 ); 284     tmp_return_value = PyTuple_New( 2 );
259     tmp_tuple_element_1 = var_s; 285     tmp_tuple_element_1 = var_s;
260 286
n 261     if ( tmp_tuple_element_1 == NULL ) n 287     CHECK_OBJECT( tmp_tuple_element_1 );
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 = "oo";
273         goto frame_exception_exit_1;
274     }
275  
276     Py_INCREF( tmp_tuple_element_1 ); 288     Py_INCREF( tmp_tuple_element_1 );
277     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 289     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
278     tmp_tuple_element_1 = var_local_value; 290     tmp_tuple_element_1 = var_local_value;
279 291
n 280     if ( tmp_tuple_element_1 == NULL ) n 292     CHECK_OBJECT( tmp_tuple_element_1 );
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 = "oo";
292         goto frame_exception_exit_1;
293     }
294  
295     Py_INCREF( tmp_tuple_element_1 ); 293     Py_INCREF( tmp_tuple_element_1 );
296     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 294     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
n 297     goto frame_return_exit_1; n
298  
299 #if 0
300     RESTORE_FRAME_EXCEPTION( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
301 #endif
302  
303     // Put the previous frame back on top.
304     popFrameStack();
305  
306     goto frame_no_exception_1;
307  
308     frame_return_exit_1:;
309 #if 0
310     RESTORE_FRAME_EXCEPTION( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
311 #endif
312  
313     // Put the previous frame back on top.
314     popFrameStack();
315  
316     goto try_return_handler_1; 295     goto try_return_handler_1;
n 317   n
318     frame_exception_exit_1:;
319  
320 #if 0
321     RESTORE_FRAME_EXCEPTION( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
322 #endif
323  
324     if ( exception_tb == NULL )
325     {
326         exception_tb = MAKE_TRACEBACK( frame_e01eaa42ff4fd24fd9d7f5a030f711ac, exception_lineno );
327     }
328     else if ( exception_tb->tb_frame != &frame_e01eaa42ff4fd24fd9d7f5a030f711ac->m_frame )
329     {
330         exception_tb = ADD_TRACEBACK( exception_tb, frame_e01eaa42ff4fd24fd9d7f5a030f711ac, exception_lineno );
331     }
332  
333     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_e01eaa42ff4fd24fd9d7f5a030f711ac, type_description ,var_local_value, var_s );
334  
335     // Release cached frame.
336     if ( frame_e01eaa42ff4fd24fd9d7f5a030f711ac == cache_frame_e01eaa42ff4fd24fd9d7f5a030f711ac )
337     {
338         Py_DECREF( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
339     }
340     cache_frame_e01eaa42ff4fd24fd9d7f5a030f711ac = NULL;
341  
342     assertFrameObject( frame_e01eaa42ff4fd24fd9d7f5a030f711ac );
343  
344  
345     // Put the previous frame back on top.
346     popFrameStack();
347  
348     // Return the error.
349     goto try_except_handler_1;
350  
351     frame_no_exception_1:;
352  
353     // tried codes exits in all cases 296     // tried codes exits in all cases
354     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 297     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
355     return NULL; 298     return NULL;
356     // Return handler code: 299     // Return handler code:
357     try_return_handler_1:; 300     try_return_handler_1:;
n n 301     CHECK_OBJECT( (PyObject *)var_local_value );
358     Py_XDECREF( var_local_value ); 302     Py_DECREF( var_local_value );
359     var_local_value = NULL; 303     var_local_value = NULL;
360 304
361     Py_XDECREF( var_s ); 305     Py_XDECREF( var_s );
362     var_s = NULL; 306     var_s = NULL;
363 307
373     exception_tb = NULL; 317     exception_tb = NULL;
374     exception_lineno = 0; 318     exception_lineno = 0;
375 319
376     Py_XDECREF( var_local_value ); 320     Py_XDECREF( var_local_value );
377     var_local_value = NULL; 321     var_local_value = NULL;
t 378   t
379     Py_XDECREF( var_s );
380     var_s = NULL;
381 322
382     // Re-raise. 323     // Re-raise.
383     exception_type = exception_keeper_type_1; 324     exception_type = exception_keeper_type_1;
384     exception_value = exception_keeper_value_1; 325     exception_value = exception_keeper_value_1;
385     exception_tb = exception_keeper_tb_1; 326     exception_tb = exception_keeper_tb_1;