Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)15260599288.11538461538461257.0CPython 2.737300944240.03846153846155443.71384335036714Nuitka (master)37301707391.96153846153845443.71260782195844Nuitka (develop)37302654543.8846153846154443.7110743417447Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)14258452888.11538461538461257.0CPython 3.538303838240.03846153846155437.7304283204395Nuitka (master)38303300391.96153846153845437.7313607363109Nuitka (develop)38303766543.8846153846154437.73055310471966Nuitka (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. */
284             goto frame_exception_exit_1; 279             goto frame_exception_exit_1;
285         } 280         }
286         assert( var_inst == NULL ); 281         assert( var_inst == NULL );
287         var_inst = tmp_assign_source_1; 282         var_inst = tmp_assign_source_1;
288     } 283     }
n 289     { n
290         PyObject *tmp_called_instance_1;
291         PyObject *tmp_call_result_1;
292         CHECK_OBJECT( var_inst );
293         tmp_called_instance_1 = var_inst;
294         frame_034c273d6899dc5c16922c237f3a978f->m_frame.f_lineno = 32;
295         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 ) );
296  
297         if ( tmp_call_result_1 == NULL )
298         {
299             assert( ERROR_OCCURRED() );
300  
301             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
302  
303  
304             exception_lineno = 32;
305             type_description_1 = "o";
306             goto frame_exception_exit_1;
307         }
308         Py_DECREF( tmp_call_result_1 );
309     }
310     {
311         PyObject *tmp_called_instance_2;
312         PyObject *tmp_call_result_2;
313         CHECK_OBJECT( var_inst );
314         tmp_called_instance_2 = var_inst;
315         frame_034c273d6899dc5c16922c237f3a978f->m_frame.f_lineno = 33;
316         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 ) );
317  
318         if ( tmp_call_result_2 == NULL )
319         {
320             assert( ERROR_OCCURRED() );
321  
322             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
323  
324  
325             exception_lineno = 33;
326             type_description_1 = "o";
327             goto frame_exception_exit_1;
328         }
329         Py_DECREF( tmp_call_result_2 );
330     }
331     {
332         PyObject *tmp_called_instance_3;
333         PyObject *tmp_call_result_3;
334         CHECK_OBJECT( var_inst );
335         tmp_called_instance_3 = var_inst;
336         frame_034c273d6899dc5c16922c237f3a978f->m_frame.f_lineno = 34;
337         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 ) );
338  
339         if ( tmp_call_result_3 == NULL )
340         {
341             assert( ERROR_OCCURRED() );
342  
343             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
344  
345  
346             exception_lineno = 34;
347             type_description_1 = "o";
348             goto frame_exception_exit_1;
349         }
350         Py_DECREF( tmp_call_result_3 );
351     }
352 284
353 #if 0 285 #if 0
354     RESTORE_FRAME_EXCEPTION( frame_034c273d6899dc5c16922c237f3a978f ); 286     RESTORE_FRAME_EXCEPTION( frame_034c273d6899dc5c16922c237f3a978f );
355 #endif 287 #endif
356 288
419     exception_keeper_lineno_1 = exception_lineno; 351     exception_keeper_lineno_1 = exception_lineno;
420     exception_type = NULL; 352     exception_type = NULL;
421     exception_value = NULL; 353     exception_value = NULL;
422     exception_tb = NULL; 354     exception_tb = NULL;
423     exception_lineno = 0; 355     exception_lineno = 0;
t 424   t
425     Py_XDECREF( var_inst );
426     var_inst = NULL;
427 356
428     // Re-raise. 357     // Re-raise.
429     exception_type = exception_keeper_type_1; 358     exception_type = exception_keeper_type_1;
430     exception_value = exception_keeper_value_1; 359     exception_value = exception_keeper_value_1;
431     exception_tb = exception_keeper_tb_1; 360     exception_tb = exception_keeper_tb_1;