Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)15411118688.11538461538461257.0CPython 2.737901599240.03846153846155443.3406384238715Nuitka (master)37901564391.96153846153845443.34069454593947Nuitka (develop)37901623543.8846153846154443.3405999401677Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)14153469988.11538461538461257.0CPython 3.538903177240.03846153846155436.19159196920543Nuitka (master)38903545391.96153846153845436.1909494521253Nuitka (develop)38903297543.8846153846154436.1913824527663Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a):
        return a

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin
    inst.compiled_method("some")
    inst.compiled_method("some")
    inst.compiled_method("some")

# construct_alternative



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a):
        return a

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin




# construct_alternative
    pass
# construct_end

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
27     inst = C() 27     inst = C()
28 28
29     # This is supposed to make a call to a non-compiled function, which is 29     # This is supposed to make a call to a non-compiled function, which is
30     # being optimized separately. 30     # being optimized separately.
31 # construct_begin 31 # construct_begin
n 32     inst.compiled_method("some") n 32  
33     inst.compiled_method("some") 33  
34     inst.compiled_method("some") 34  
35 35
36 # construct_alternative 36 # construct_alternative
t 37   t 37     pass
38   38 # construct_end
39 39
40 import itertools 40 import itertools
41 for x in itertools.repeat(None, 50000): 41 for x in itertools.repeat(None, 50000):
42     calledRepeatedly() 42     calledRepeatedly()
43 43

Context Diff of Generated Code


Construct
Baseline
59 static PyObject *const_str_plain_C; 59 static PyObject *const_str_plain_C;
60 extern PyObject *const_tuple_empty; 60 extern PyObject *const_tuple_empty;
61 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 61 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
62 static PyObject *const_tuple_str_plain_inst_tuple; 62 static PyObject *const_tuple_str_plain_inst_tuple;
63 static PyObject *const_str_plain_repeat; 63 static PyObject *const_str_plain_repeat;
n 64 static PyObject *const_str_plain_some; n
65 static PyObject *const_tuple_none_int_pos_50000_tuple; 64 static PyObject *const_tuple_none_int_pos_50000_tuple;
66 static PyObject *const_str_digest_a52b6af29fa2e0ee8e48c696d2d39416; 65 static PyObject *const_str_digest_a52b6af29fa2e0ee8e48c696d2d39416;
n 67 static PyObject *const_tuple_str_plain_some_tuple; n
68 extern PyObject *const_str_plain_type; 66 extern PyObject *const_str_plain_type;
69 extern PyObject *const_str_plain___main__; 67 extern PyObject *const_str_plain___main__;
70 extern PyObject *const_str_plain___doc__; 68 extern PyObject *const_str_plain___doc__;
71 extern PyObject *const_str_plain___cached__; 69 extern PyObject *const_str_plain___cached__;
72 static PyObject *const_str_plain_print_function; 70 static PyObject *const_str_plain_print_function;
106     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 114 ], 4, 1 ); 104     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 114 ], 4, 1 );
107     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 1, 1 ); 105     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 1, 1 );
108     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 ); 106     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 );
109     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst ); 107     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
110     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 119 ], 6, 1 ); 108     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 119 ], 6, 1 );
n 111     const_str_plain_some = UNSTREAM_STRING_ASCII( &constant_bin[ 125 ], 4, 1 ); n
112     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 109     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
113     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 110     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
114     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 111     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 115     const_str_digest_a52b6af29fa2e0ee8e48c696d2d39416 = UNSTREAM_STRING_ASCII( &constant_bin[ 129 ], 91, 0 ); n 112     const_str_digest_a52b6af29fa2e0ee8e48c696d2d39416 = UNSTREAM_STRING_ASCII( &constant_bin[ 125 ], 91, 0 );
116     const_tuple_str_plain_some_tuple = PyTuple_New( 1 );
117     PyTuple_SET_ITEM( const_tuple_str_plain_some_tuple, 0, const_str_plain_some ); Py_INCREF( const_str_plain_some );
118     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 220 ], 14, 1 ); 113     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 216 ], 14, 1 );
119 114
120     constants_created = true; 115     constants_created = true;
121 } 116 }
122 117
123 #ifndef __NUITKA_NO_ASSERT__ 118 #ifndef __NUITKA_NO_ASSERT__
289     } 284     }
290     assert( var_inst == NULL ); 285     assert( var_inst == NULL );
291     var_inst = tmp_assign_source_1; 286     var_inst = tmp_assign_source_1;
292 287
293     } 288     }
n 294     { n
295     PyObject *tmp_called_instance_1;
296     PyObject *tmp_call_result_1;
297     CHECK_OBJECT( var_inst );
298     tmp_called_instance_1 = var_inst;
299     frame_85413e1f3db71e596f1c5c0cf400f650->m_frame.f_lineno = 32;
300     tmp_call_result_1 = CALL_METHOD_WITH_ARGS1( tmp_called_instance_1, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
301  
302     if ( tmp_call_result_1 == NULL )
303     {
304         assert( ERROR_OCCURRED() );
305  
306         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
307  
308  
309         exception_lineno = 32;
310         type_description_1 = "o";
311         goto frame_exception_exit_1;
312     }
313     Py_DECREF( tmp_call_result_1 );
314     }
315     {
316     PyObject *tmp_called_instance_2;
317     PyObject *tmp_call_result_2;
318     if ( var_inst == NULL )
319     {
320  
321         exception_type = PyExc_UnboundLocalError;
322         Py_INCREF( exception_type );
323         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
324         exception_tb = NULL;
325         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
326         CHAIN_EXCEPTION( exception_value );
327  
328         exception_lineno = 33;
329         type_description_1 = "o";
330         goto frame_exception_exit_1;
331     }
332  
333     tmp_called_instance_2 = var_inst;
334     frame_85413e1f3db71e596f1c5c0cf400f650->m_frame.f_lineno = 33;
335     tmp_call_result_2 = CALL_METHOD_WITH_ARGS1( tmp_called_instance_2, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
336  
337     if ( tmp_call_result_2 == NULL )
338     {
339         assert( ERROR_OCCURRED() );
340  
341         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
342  
343  
344         exception_lineno = 33;
345         type_description_1 = "o";
346         goto frame_exception_exit_1;
347     }
348     Py_DECREF( tmp_call_result_2 );
349     }
350     {
351     PyObject *tmp_called_instance_3;
352     PyObject *tmp_call_result_3;
353     if ( var_inst == NULL )
354     {
355  
356         exception_type = PyExc_UnboundLocalError;
357         Py_INCREF( exception_type );
358         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
359         exception_tb = NULL;
360         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
361         CHAIN_EXCEPTION( exception_value );
362  
363         exception_lineno = 34;
364         type_description_1 = "o";
365         goto frame_exception_exit_1;
366     }
367  
368     tmp_called_instance_3 = var_inst;
369     frame_85413e1f3db71e596f1c5c0cf400f650->m_frame.f_lineno = 34;
370     tmp_call_result_3 = CALL_METHOD_WITH_ARGS1( tmp_called_instance_3, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
371  
372     if ( tmp_call_result_3 == NULL )
373     {
374         assert( ERROR_OCCURRED() );
375  
376         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
377  
378  
379         exception_lineno = 34;
380         type_description_1 = "o";
381         goto frame_exception_exit_1;
382     }
383     Py_DECREF( tmp_call_result_3 );
384     }
385 289
386 #if 0 290 #if 0
387     RESTORE_FRAME_EXCEPTION( frame_85413e1f3db71e596f1c5c0cf400f650 ); 291     RESTORE_FRAME_EXCEPTION( frame_85413e1f3db71e596f1c5c0cf400f650 );
388 #endif 292 #endif
389 293
440     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly ); 344     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly );
441     return NULL; 345     return NULL;
442     // Return handler code: 346     // Return handler code:
443     try_return_handler_1:; 347     try_return_handler_1:;
444     { 348     {
n n 349     CHECK_OBJECT( (PyObject *)var_inst );
445     Py_XDECREF( var_inst ); 350     Py_DECREF( var_inst );
446     var_inst = NULL; 351     var_inst = NULL;
447 352
448     } 353     }
449     { 354     {
450     goto function_return_exit; 355     goto function_return_exit;
458     exception_type = NULL; 363     exception_type = NULL;
459     exception_value = NULL; 364     exception_value = NULL;
460     exception_tb = NULL; 365     exception_tb = NULL;
461     exception_lineno = 0; 366     exception_lineno = 0;
462 367
t 463     { t
464     Py_XDECREF( var_inst );
465     var_inst = NULL;
466  
467     }
468     { 368     {
469     // Re-raise. 369     // Re-raise.
470     exception_type = exception_keeper_type_1; 370     exception_type = exception_keeper_type_1;
471     exception_value = exception_keeper_value_1; 371     exception_value = exception_keeper_value_1;
472     exception_tb = exception_keeper_tb_1; 372     exception_tb = exception_keeper_tb_1;