Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14211433188.11538461538461257.0CPython 2.737650989240.03846153846155438.6459941435355Nuitka (master)37652382391.96153846153845438.64357192666023Nuitka (develop)36001715543.8846153846154441.51383284761494Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)13718576788.11538461538461257.00000000000006CPython 3.539703473240.03846153846155432.59674813058416Nuitka (master)39703622391.96153846153845432.59647973399234Nuitka (develop)39541303543.8846153846154432.8888680989995Nuitka (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[ 228 ], 1, 1); 108     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 228 ], 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[ 229 ], 6, 1); 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 229 ], 6, 1);
n 114     const_str_plain_some = UNSTREAM_STRING_ASCII(&constant_bin[ 235 ], 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[ 239 ], 14, 1); 115     const_str_plain_print_function = UNSTREAM_STRING_ASCII(&constant_bin[ 235 ], 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. */
266             goto frame_exception_exit_1; 261             goto frame_exception_exit_1;
267         } 262         }
268         assert(var_inst == NULL); 263         assert(var_inst == NULL);
269         var_inst = tmp_assign_source_1; 264         var_inst = tmp_assign_source_1;
270     } 265     }
n 271     { n
272         PyObject *tmp_called_instance_1;
273         PyObject *tmp_call_result_1;
274         CHECK_OBJECT(var_inst);
275         tmp_called_instance_1 = var_inst;
276         frame_97ac37053775df258bb28ab5853c31d3->m_frame.f_lineno = 32;
277         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));
278  
279         if (tmp_call_result_1 == NULL) {
280             assert(ERROR_OCCURRED());
281  
282             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
283  
284  
285             exception_lineno = 32;
286             type_description_1 = "o";
287             goto frame_exception_exit_1;
288         }
289         Py_DECREF(tmp_call_result_1);
290     }
291     {
292         PyObject *tmp_called_instance_2;
293         PyObject *tmp_call_result_2;
294         CHECK_OBJECT(var_inst);
295         tmp_called_instance_2 = var_inst;
296         frame_97ac37053775df258bb28ab5853c31d3->m_frame.f_lineno = 33;
297         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));
298  
299         if (tmp_call_result_2 == NULL) {
300             assert(ERROR_OCCURRED());
301  
302             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
303  
304  
305             exception_lineno = 33;
306             type_description_1 = "o";
307             goto frame_exception_exit_1;
308         }
309         Py_DECREF(tmp_call_result_2);
310     }
311     {
312         PyObject *tmp_called_instance_3;
313         PyObject *tmp_call_result_3;
314         CHECK_OBJECT(var_inst);
315         tmp_called_instance_3 = var_inst;
316         frame_97ac37053775df258bb28ab5853c31d3->m_frame.f_lineno = 34;
317         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));
318  
319         if (tmp_call_result_3 == NULL) {
320             assert(ERROR_OCCURRED());
321  
322             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
323  
324  
325             exception_lineno = 34;
326             type_description_1 = "o";
327             goto frame_exception_exit_1;
328         }
329         Py_DECREF(tmp_call_result_3);
330     }
331 266
332 #if 0 267 #if 0
333     RESTORE_FRAME_EXCEPTION(frame_97ac37053775df258bb28ab5853c31d3); 268     RESTORE_FRAME_EXCEPTION(frame_97ac37053775df258bb28ab5853c31d3);
334 #endif 269 #endif
335 270
395     exception_keeper_lineno_1 = exception_lineno; 330     exception_keeper_lineno_1 = exception_lineno;
396     exception_type = NULL; 331     exception_type = NULL;
397     exception_value = NULL; 332     exception_value = NULL;
398     exception_tb = NULL; 333     exception_tb = NULL;
399     exception_lineno = 0; 334     exception_lineno = 0;
t 400   t
401     Py_XDECREF(var_inst);
402     var_inst = NULL;
403 335
404     // Re-raise. 336     // Re-raise.
405     exception_type = exception_keeper_type_1; 337     exception_type = exception_keeper_type_1;
406     exception_value = exception_keeper_value_1; 338     exception_value = exception_keeper_value_1;
407     exception_tb = exception_keeper_tb_1; 339     exception_tb = exception_keeper_tb_1;