Construct OperationAttributeLookup

Performance Diagrams

Construct OperationAttributeLookup 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1658316788.95192307692307257.0CPython 2.79400569242.31730769230768364.0320565008899Nuitka (master)9400611395.6826923076923364.03143063454274Nuitka (develop)9400689549.0480769230769364.0302683113267Nuitka (factory)Construct OperationAttributeLookupTicks Construct OperationAttributeLookup 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1651667788.95192307692307257.0CPython 3.59802231242.31730769230768357.45863982017875Nuitka (master)9789170395.6826923076923357.6540528586769Nuitka (develop)9801504549.0480769230769357.4695168800508Nuitka (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
48 static PyObject *const_str_plain_x; 48 static PyObject *const_str_plain_x;
49 extern PyObject *const_tuple_empty; 49 extern PyObject *const_tuple_empty;
50 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 50 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
51 static PyObject *const_str_plain_repeat; 51 static PyObject *const_str_plain_repeat;
52 static PyObject *const_int_pos_3000; 52 static PyObject *const_int_pos_3000;
n 53 static PyObject *const_str_plain_append; n
54 static PyObject *const_tuple_none_int_pos_50000_tuple; 53 static PyObject *const_tuple_none_int_pos_50000_tuple;
55 extern PyObject *const_str_plain___main__; 54 extern PyObject *const_str_plain___main__;
56 static PyObject *const_str_digest_e52a9346349339f5e00e126d36ef2a2a; 55 static PyObject *const_str_digest_e52a9346349339f5e00e126d36ef2a2a;
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__;
78     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 65 ], 8, 0 ); 77     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 65 ], 8, 0 );
79     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 73 ], 4, 1 ); 78     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 73 ], 4, 1 );
80     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 77 ], 1, 1 ); 79     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 77 ], 1, 1 );
81     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 78 ], 6, 1 ); 80     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 78 ], 6, 1 );
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[ 84 ], 6, 1 ); n
84     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 82     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
85     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 83     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
86     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 84     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 87     const_str_digest_e52a9346349339f5e00e126d36ef2a2a = UNSTREAM_STRING( &constant_bin[ 90 ], 82, 0 ); n 85     const_str_digest_e52a9346349339f5e00e126d36ef2a2a = UNSTREAM_STRING( &constant_bin[ 84 ], 82, 0 );
88 86
89     constants_created = true; 87     constants_created = true;
90 } 88 }
91 89
92 #ifndef __NUITKA_NO_ASSERT__ 90 #ifndef __NUITKA_NO_ASSERT__
133     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 131     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
134     PyObject *exception_type = NULL; 132     PyObject *exception_type = NULL;
135     PyObject *exception_value = NULL; 133     PyObject *exception_value = NULL;
136     PyTracebackObject *exception_tb = NULL; 134     PyTracebackObject *exception_tb = NULL;
137     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 135     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 136     static struct Nuitka_FrameObject *cache_frame_b8f32f523d37b30be4e5852334ac1ac9 = NULL;
138     PyObject *tmp_return_value = NULL; 137     PyObject *tmp_return_value = NULL;
n 139     static struct Nuitka_FrameObject *cache_frame_b8f32f523d37b30be4e5852334ac1ac9 = NULL; n
140     PyObject *exception_keeper_type_1; 138     PyObject *exception_keeper_type_1;
141     PyObject *exception_keeper_value_1; 139     PyObject *exception_keeper_value_1;
142     PyTracebackObject *exception_keeper_tb_1; 140     PyTracebackObject *exception_keeper_tb_1;
143     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 141     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
144 142
235     assert( var_s == NULL ); 233     assert( var_s == NULL );
236     Py_INCREF( tmp_assign_source_2 ); 234     Py_INCREF( tmp_assign_source_2 );
237     var_s = tmp_assign_source_2; 235     var_s = tmp_assign_source_2;
238 236
239     } 237     }
n 240     { n
241     PyObject *tmp_source_name_1;
242     tmp_source_name_1 = var_s;
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     }
259     {
260     PyObject *tmp_tuple_element_1;
261     tmp_tuple_element_1 = var_s;
262  
263     if ( tmp_tuple_element_1 == NULL )
264     {
265  
266         exception_type = PyExc_UnboundLocalError;
267         Py_INCREF( exception_type );
268         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
269         exception_tb = NULL;
270         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
271         CHAIN_EXCEPTION( exception_value );
272  
273         exception_lineno = 35;
274         type_description_1 = "oo";
275         goto frame_exception_exit_1;
276     }
277  
278     tmp_return_value = PyTuple_New( 2 );
279     Py_INCREF( tmp_tuple_element_1 );
280     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
281     tmp_tuple_element_1 = var_local_value;
282  
283     if ( tmp_tuple_element_1 == NULL )
284     {
285         Py_DECREF( tmp_return_value );
286         exception_type = PyExc_UnboundLocalError;
287         Py_INCREF( exception_type );
288         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
289         exception_tb = NULL;
290         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
291         CHAIN_EXCEPTION( exception_value );
292  
293         exception_lineno = 35;
294         type_description_1 = "oo";
295         goto frame_exception_exit_1;
296     }
297  
298     Py_INCREF( tmp_tuple_element_1 );
299     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
300     goto frame_return_exit_1;
301     }
302 238
303 #if 0 239 #if 0
304     RESTORE_FRAME_EXCEPTION( frame_b8f32f523d37b30be4e5852334ac1ac9 ); 240     RESTORE_FRAME_EXCEPTION( frame_b8f32f523d37b30be4e5852334ac1ac9 );
305 #endif 241 #endif
306 242
307     // Put the previous frame back on top. 243     // Put the previous frame back on top.
308     popFrameStack(); 244     popFrameStack();
309 245
310     goto frame_no_exception_1; 246     goto frame_no_exception_1;
n 311   n
312     frame_return_exit_1:;
313 #if 0
314     RESTORE_FRAME_EXCEPTION( frame_b8f32f523d37b30be4e5852334ac1ac9 );
315 #endif
316  
317     // Put the previous frame back on top.
318     popFrameStack();
319  
320     goto try_return_handler_1;
321 247
322     frame_exception_exit_1:; 248     frame_exception_exit_1:;
323 249
324 #if 0 250 #if 0
325     RESTORE_FRAME_EXCEPTION( frame_b8f32f523d37b30be4e5852334ac1ac9 ); 251     RESTORE_FRAME_EXCEPTION( frame_b8f32f523d37b30be4e5852334ac1ac9 );
358     // Return the error. 284     // Return the error.
359     goto try_except_handler_1; 285     goto try_except_handler_1;
360 286
361     frame_no_exception_1:; 287     frame_no_exception_1:;
362 288
n n 289     {
290     PyObject *tmp_tuple_element_1;
291     tmp_tuple_element_1 = var_s;
292  
293     CHECK_OBJECT( tmp_tuple_element_1 );
294     tmp_return_value = PyTuple_New( 2 );
295     Py_INCREF( tmp_tuple_element_1 );
296     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
297     tmp_tuple_element_1 = var_local_value;
298  
299     CHECK_OBJECT( tmp_tuple_element_1 );
300     Py_INCREF( tmp_tuple_element_1 );
301     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
302     goto try_return_handler_1;
303     }
363     // tried codes exits in all cases 304     // tried codes exits in all cases
364     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 305     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
365     return NULL; 306     return NULL;
366     // Return handler code: 307     // Return handler code:
367     try_return_handler_1:; 308     try_return_handler_1:;
368     { 309     {
n n 310     CHECK_OBJECT( (PyObject *)var_s );
369     Py_XDECREF( var_s ); 311     Py_DECREF( var_s );
370     var_s = NULL; 312     var_s = NULL;
371 313
372     } 314     }
373     { 315     {
374     Py_XDECREF( var_local_value ); 316     Py_XDECREF( var_local_value );
387     exception_type = NULL; 329     exception_type = NULL;
388     exception_value = NULL; 330     exception_value = NULL;
389     exception_tb = NULL; 331     exception_tb = NULL;
390     exception_lineno = 0; 332     exception_lineno = 0;
391 333
t 392     { t
393     Py_XDECREF( var_s );
394     var_s = NULL;
395  
396     }
397     { 334     {
398     Py_XDECREF( var_local_value ); 335     Py_XDECREF( var_local_value );
399     var_local_value = NULL; 336     var_local_value = NULL;
400 337
401     } 338     }