Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)15260599288.11538461538461257.0CPython 2.737301323240.03846153846155443.713229634421Nuitka (master)37301191391.96153846153845443.713443382455Nuitka (develop)37301268543.8846153846154443.71331869610185Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)14258452888.11538461538461257.0CPython 3.538290094240.03846153846155437.7542482530352Nuitka (master)38303415391.96153846153845437.73116142808556Nuitka (develop)38306243543.8846153846154437.7262601788582Nuitka (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;
109     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 205 ], 4, 1 ); 107     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 205 ], 4, 1 );
110     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 1, 1 ); 108     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 1, 1 );
111     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 ); 109     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 );
112     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst ); 110     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
113     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 209 ], 6, 1 ); 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 209 ], 6, 1 );
n 114     const_str_plain_some = UNSTREAM_STRING_ASCII( &constant_bin[ 215 ], 4, 1 ); n
115     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 112     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
116     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 113     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
117     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 114     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 118     const_tuple_str_plain_some_tuple = PyTuple_New( 1 ); n
119     PyTuple_SET_ITEM( const_tuple_str_plain_some_tuple, 0, const_str_plain_some ); Py_INCREF( const_str_plain_some );
120     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 219 ], 14, 1 ); 115     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 215 ], 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_c5a9af783d90cdb97ff94686a5aa3d6f->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_c5a9af783d90cdb97ff94686a5aa3d6f->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_c5a9af783d90cdb97ff94686a5aa3d6f->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_c5a9af783d90cdb97ff94686a5aa3d6f ); 287     RESTORE_FRAME_EXCEPTION( frame_c5a9af783d90cdb97ff94686a5aa3d6f );
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;