Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)15260670388.11538461538461257.0CPython 2.737301105240.03846153846155443.71386405665896Nuitka (master)37301234391.96153846153845443.713655167508Nuitka (develop)37301185543.8846153846154443.71373451299945Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)14258410488.11538461538461257.0CPython 3.538324236240.03846153846155437.6948787276402Nuitka (master)38321998391.96153846153845437.69875745055003Nuitka (develop)38315074543.8846153846154437.7107575745125Nuitka (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 extern PyObject *const_str_plain___main__; 65 extern PyObject *const_str_plain___main__;
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 static PyObject *const_str_digest_ac66247aeaf6480529f42938c8f75f81; 67 static PyObject *const_str_digest_ac66247aeaf6480529f42938c8f75f81;
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;
108     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 114 ], 4, 1 ); 106     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 114 ], 4, 1 );
109     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 1, 1 ); 107     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 1, 1 );
110     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 ); 108     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 );
111     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst ); 109     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
112     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 119 ], 6, 1 ); 110     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 119 ], 6, 1 );
n 113     const_str_plain_some = UNSTREAM_STRING_ASCII( &constant_bin[ 125 ], 4, 1 ); n
114     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 111     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
115     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 112     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
116     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 113     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 117     const_tuple_str_plain_some_tuple = PyTuple_New( 1 ); n
118     PyTuple_SET_ITEM( const_tuple_str_plain_some_tuple, 0, const_str_plain_some ); Py_INCREF( const_str_plain_some );
119     const_str_digest_ac66247aeaf6480529f42938c8f75f81 = UNSTREAM_STRING_ASCII( &constant_bin[ 129 ], 91, 0 ); 114     const_str_digest_ac66247aeaf6480529f42938c8f75f81 = UNSTREAM_STRING_ASCII( &constant_bin[ 125 ], 91, 0 );
120     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 220 ], 14, 1 ); 115     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 216 ], 14, 1 );
121 116
122     constants_created = true; 117     constants_created = true;
123 } 118 }
124 119
125 /* Function to verify module private constants for non-corruption. */ 120 /* Function to verify module private constants for non-corruption. */
285             goto frame_exception_exit_1; 280             goto frame_exception_exit_1;
286         } 281         }
287         assert( var_inst == NULL ); 282         assert( var_inst == NULL );
288         var_inst = tmp_assign_source_1; 283         var_inst = tmp_assign_source_1;
289     } 284     }
n 290     { n
291         PyObject *tmp_called_instance_1;
292         PyObject *tmp_call_result_1;
293         CHECK_OBJECT( var_inst );
294         tmp_called_instance_1 = var_inst;
295         frame_925e0f0c30b7ba17cf21c7eb753e18fe->m_frame.f_lineno = 32;
296         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 ) );
297  
298         if ( tmp_call_result_1 == NULL )
299         {
300             assert( ERROR_OCCURRED() );
301  
302             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
303  
304  
305             exception_lineno = 32;
306             type_description_1 = "o";
307             goto frame_exception_exit_1;
308         }
309         Py_DECREF( tmp_call_result_1 );
310     }
311     {
312         PyObject *tmp_called_instance_2;
313         PyObject *tmp_call_result_2;
314         CHECK_OBJECT( var_inst );
315         tmp_called_instance_2 = var_inst;
316         frame_925e0f0c30b7ba17cf21c7eb753e18fe->m_frame.f_lineno = 33;
317         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 ) );
318  
319         if ( tmp_call_result_2 == NULL )
320         {
321             assert( ERROR_OCCURRED() );
322  
323             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
324  
325  
326             exception_lineno = 33;
327             type_description_1 = "o";
328             goto frame_exception_exit_1;
329         }
330         Py_DECREF( tmp_call_result_2 );
331     }
332     {
333         PyObject *tmp_called_instance_3;
334         PyObject *tmp_call_result_3;
335         CHECK_OBJECT( var_inst );
336         tmp_called_instance_3 = var_inst;
337         frame_925e0f0c30b7ba17cf21c7eb753e18fe->m_frame.f_lineno = 34;
338         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 ) );
339  
340         if ( tmp_call_result_3 == NULL )
341         {
342             assert( ERROR_OCCURRED() );
343  
344             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
345  
346  
347             exception_lineno = 34;
348             type_description_1 = "o";
349             goto frame_exception_exit_1;
350         }
351         Py_DECREF( tmp_call_result_3 );
352     }
353 285
354 #if 0 286 #if 0
355     RESTORE_FRAME_EXCEPTION( frame_925e0f0c30b7ba17cf21c7eb753e18fe ); 287     RESTORE_FRAME_EXCEPTION( frame_925e0f0c30b7ba17cf21c7eb753e18fe );
356 #endif 288 #endif
357 289
420     exception_keeper_lineno_1 = exception_lineno; 352     exception_keeper_lineno_1 = exception_lineno;
421     exception_type = NULL; 353     exception_type = NULL;
422     exception_value = NULL; 354     exception_value = NULL;
423     exception_tb = NULL; 355     exception_tb = NULL;
424     exception_lineno = 0; 356     exception_lineno = 0;
t 425   t
426     Py_XDECREF( var_inst );
427     var_inst = NULL;
428 357
429     // Re-raise. 358     // Re-raise.
430     exception_type = exception_keeper_type_1; 359     exception_type = exception_keeper_type_1;
431     exception_value = exception_keeper_value_1; 360     exception_value = exception_keeper_value_1;
432     exception_tb = exception_keeper_tb_1; 361     exception_tb = exception_keeper_tb_1;