Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14211433188.11538461538461257.0CPython 2.737651697240.03846153846155438.64476303833254Nuitka (master)37651828391.96153846153845438.644535249093Nuitka (develop)37652594543.8846153846154438.643203290639Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)13718576788.11538461538461257.00000000000006CPython 3.539703491240.03846153846155432.5967157068348Nuitka (master)39703990391.96153846153845432.5958168484501Nuitka (develop)39704134543.8846153846154432.59555745845535Nuitka (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[ 224 ], 4, 1 ); 107     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 224 ], 4, 1 );
110     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 147 ], 1, 1 ); 108     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 147 ], 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[ 228 ], 6, 1 ); 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 228 ], 6, 1 );
n 114     const_str_plain_some = UNSTREAM_STRING_ASCII( &constant_bin[ 234 ], 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[ 238 ], 14, 1 ); 115     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 234 ], 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. */
270             goto frame_exception_exit_1; 265             goto frame_exception_exit_1;
271         } 266         }
272         assert(var_inst == NULL); 267         assert(var_inst == NULL);
273         var_inst = tmp_assign_source_1; 268         var_inst = tmp_assign_source_1;
274     } 269     }
n 275     { n
276         PyObject *tmp_called_instance_1;
277         PyObject *tmp_call_result_1;
278         CHECK_OBJECT(var_inst);
279         tmp_called_instance_1 = var_inst;
280         frame_26e3a60288bf40a1fff4b23c33303948->m_frame.f_lineno = 32;
281         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 ) );
282  
283         if ( tmp_call_result_1 == NULL )
284         {
285             assert(ERROR_OCCURRED());
286  
287             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
288  
289  
290             exception_lineno = 32;
291             type_description_1 = "o";
292             goto frame_exception_exit_1;
293         }
294         Py_DECREF(tmp_call_result_1);
295     }
296     {
297         PyObject *tmp_called_instance_2;
298         PyObject *tmp_call_result_2;
299         CHECK_OBJECT(var_inst);
300         tmp_called_instance_2 = var_inst;
301         frame_26e3a60288bf40a1fff4b23c33303948->m_frame.f_lineno = 33;
302         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 ) );
303  
304         if ( tmp_call_result_2 == NULL )
305         {
306             assert(ERROR_OCCURRED());
307  
308             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
309  
310  
311             exception_lineno = 33;
312             type_description_1 = "o";
313             goto frame_exception_exit_1;
314         }
315         Py_DECREF(tmp_call_result_2);
316     }
317     {
318         PyObject *tmp_called_instance_3;
319         PyObject *tmp_call_result_3;
320         CHECK_OBJECT(var_inst);
321         tmp_called_instance_3 = var_inst;
322         frame_26e3a60288bf40a1fff4b23c33303948->m_frame.f_lineno = 34;
323         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 ) );
324  
325         if ( tmp_call_result_3 == NULL )
326         {
327             assert(ERROR_OCCURRED());
328  
329             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
330  
331  
332             exception_lineno = 34;
333             type_description_1 = "o";
334             goto frame_exception_exit_1;
335         }
336         Py_DECREF(tmp_call_result_3);
337     }
338 270
339 #if 0 271 #if 0
340     RESTORE_FRAME_EXCEPTION(frame_26e3a60288bf40a1fff4b23c33303948); 272     RESTORE_FRAME_EXCEPTION(frame_26e3a60288bf40a1fff4b23c33303948);
341 #endif 273 #endif
342 274
402     exception_keeper_lineno_1 = exception_lineno; 334     exception_keeper_lineno_1 = exception_lineno;
403     exception_type = NULL; 335     exception_type = NULL;
404     exception_value = NULL; 336     exception_value = NULL;
405     exception_tb = NULL; 337     exception_tb = NULL;
406     exception_lineno = 0; 338     exception_lineno = 0;
t 407   t
408     Py_XDECREF(var_inst);
409     var_inst = NULL;
410 339
411     // Re-raise. 340     // Re-raise.
412     exception_type = exception_keeper_type_1; 341     exception_type = exception_keeper_type_1;
413     exception_value = exception_keeper_value_1; 342     exception_value = exception_keeper_value_1;
414     exception_tb = exception_keeper_tb_1; 343     exception_tb = exception_keeper_tb_1;