Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)15411118688.11538461538461257.0CPython 2.738201258240.03846153846155442.86013891594826Nuitka (master)37301249391.96153846153845444.3032922389803Nuitka (develop)37301266543.8846153846154444.30326497969014Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)14153469988.11538461538461257.0CPython 3.538761613240.03846153846155436.4387585124974Nuitka (master)38309236391.96153846153845437.22859533086057Nuitka (develop)38303245543.8846153846154437.23905543908626Nuitka (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
60 static PyObject *const_str_plain_C; 60 static PyObject *const_str_plain_C;
61 extern PyObject *const_tuple_empty; 61 extern PyObject *const_tuple_empty;
62 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 62 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
63 static PyObject *const_tuple_str_plain_inst_tuple; 63 static PyObject *const_tuple_str_plain_inst_tuple;
64 static PyObject *const_str_plain_repeat; 64 static PyObject *const_str_plain_repeat;
n 65 static PyObject *const_str_plain_some; n
66 static PyObject *const_tuple_none_int_pos_50000_tuple; 65 static PyObject *const_tuple_none_int_pos_50000_tuple;
67 extern PyObject *const_str_plain___main__; 66 extern PyObject *const_str_plain___main__;
n 68 static PyObject *const_tuple_str_plain_some_tuple; n
69 extern PyObject *const_str_plain_type; 67 extern PyObject *const_str_plain_type;
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;
73 static PyObject *module_filename_obj; 71 static PyObject *module_filename_obj;
107     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 205 ], 4, 1 ); 105     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 205 ], 4, 1 );
108     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 1, 1 ); 106     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 1, 1 );
109     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 ); 107     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 );
110     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst ); 108     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
111     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 209 ], 6, 1 ); 109     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 209 ], 6, 1 );
n 112     const_str_plain_some = UNSTREAM_STRING_ASCII( &constant_bin[ 215 ], 4, 1 ); n
113     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 110     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
114     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 111     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
115     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 112     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 116     const_tuple_str_plain_some_tuple = PyTuple_New( 1 ); n
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[ 219 ], 14, 1 ); 113     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 215 ], 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__
290     } 285     }
291     assert( var_inst == NULL ); 286     assert( var_inst == NULL );
292     var_inst = tmp_assign_source_1; 287     var_inst = tmp_assign_source_1;
293 288
294     } 289     }
n 295     { n
296     PyObject *tmp_called_instance_1;
297     PyObject *tmp_call_result_1;
298     CHECK_OBJECT( var_inst );
299     tmp_called_instance_1 = var_inst;
300     frame_acfa3285f0ecdbec84c9564dae137723->m_frame.f_lineno = 32;
301     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 ) );
302  
303     if ( tmp_call_result_1 == NULL )
304     {
305         assert( ERROR_OCCURRED() );
306  
307         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
308  
309  
310         exception_lineno = 32;
311         type_description_1 = "o";
312         goto frame_exception_exit_1;
313     }
314     Py_DECREF( tmp_call_result_1 );
315     }
316     {
317     PyObject *tmp_called_instance_2;
318     PyObject *tmp_call_result_2;
319     CHECK_OBJECT( var_inst );
320     tmp_called_instance_2 = var_inst;
321     frame_acfa3285f0ecdbec84c9564dae137723->m_frame.f_lineno = 33;
322     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 ) );
323  
324     if ( tmp_call_result_2 == NULL )
325     {
326         assert( ERROR_OCCURRED() );
327  
328         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
329  
330  
331         exception_lineno = 33;
332         type_description_1 = "o";
333         goto frame_exception_exit_1;
334     }
335     Py_DECREF( tmp_call_result_2 );
336     }
337     {
338     PyObject *tmp_called_instance_3;
339     PyObject *tmp_call_result_3;
340     CHECK_OBJECT( var_inst );
341     tmp_called_instance_3 = var_inst;
342     frame_acfa3285f0ecdbec84c9564dae137723->m_frame.f_lineno = 34;
343     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 ) );
344  
345     if ( tmp_call_result_3 == NULL )
346     {
347         assert( ERROR_OCCURRED() );
348  
349         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
350  
351  
352         exception_lineno = 34;
353         type_description_1 = "o";
354         goto frame_exception_exit_1;
355     }
356     Py_DECREF( tmp_call_result_3 );
357     }
358 290
359 #if 0 291 #if 0
360     RESTORE_FRAME_EXCEPTION( frame_acfa3285f0ecdbec84c9564dae137723 ); 292     RESTORE_FRAME_EXCEPTION( frame_acfa3285f0ecdbec84c9564dae137723 );
361 #endif 293 #endif
362 294
432     exception_type = NULL; 364     exception_type = NULL;
433     exception_value = NULL; 365     exception_value = NULL;
434     exception_tb = NULL; 366     exception_tb = NULL;
435     exception_lineno = 0; 367     exception_lineno = 0;
436 368
t 437     { t
438     Py_XDECREF( var_inst );
439     var_inst = NULL;
440  
441     }
442     { 369     {
443     // Re-raise. 370     // Re-raise.
444     exception_type = exception_keeper_type_1; 371     exception_type = exception_keeper_type_1;
445     exception_value = exception_keeper_value_1; 372     exception_value = exception_keeper_value_1;
446     exception_tb = exception_keeper_tb_1; 373     exception_tb = exception_keeper_tb_1;