Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6364972688.95192307692307257.0CPython 2.753963804242.31730769230768294.60488050466415Nuitka (master)53964000395.6826923076923294.604119549065Nuitka (develop)53963840549.0480769230769294.6047407373092Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7143329488.95192307692307257.0CPython 3.561455761242.31730769230768291.5161445978914Nuitka (master)61456078395.6826923076923291.51504797231905Nuitka (develop)61462223549.0480769230769291.4937900412699Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks

Source Code with Construct

from __future__ import print_function

exec("""
def python_func(a,b,c,d,e,f):
    pass
""")

a = (
   1, 2, 3, 4, 5
)

def calledRepeatedly():
    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
    args = a

# construct_begin
    python_func(3, *a)
# construct_alternative



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

exec("""
def python_func(a,b,c,d,e,f):
    pass
""")

a = (
   1, 2, 3, 4, 5
)

def calledRepeatedly():
    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
    args = a

# 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
32     # This is supposed to make a call to a non-compiled function, which is 32     # This is supposed to make a call to a non-compiled function, which is
33     # being optimized separately. 33     # being optimized separately.
34     args = a 34     args = a
35 35
36 # construct_begin 36 # construct_begin
n 37     python_func(3, *a) n 37  
38 # construct_alternative 38 # construct_alternative
t 39   t 39     pass
40   40 # construct_end
41 41
42 import itertools 42 import itertools
43 for x in itertools.repeat(None, 50000): 43 for x in itertools.repeat(None, 50000):
44     calledRepeatedly() 44     calledRepeatedly()
45 45

Context Diff of Generated Code


Construct
Baseline
33 /* The declarations of module constants used, if any. */ 33 /* The declarations of module constants used, if any. */
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
35 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple; 35 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple;
36 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d; 36 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d;
37 static PyObject *const_tuple_str_plain_args_tuple; 37 static PyObject *const_tuple_str_plain_args_tuple;
n 38 static PyObject *const_tuple_int_pos_3_tuple; n
39 extern PyObject *const_int_pos_1; 38 extern PyObject *const_int_pos_1;
40 extern PyObject *const_str_plain___file__; 39 extern PyObject *const_str_plain___file__;
41 static PyObject *const_str_plain_args; 40 static PyObject *const_str_plain_args;
42 extern PyObject *const_int_0; 41 extern PyObject *const_int_0;
43 extern PyObject *const_str_plain_print; 42 extern PyObject *const_str_plain_print;
51 static PyObject *const_str_angle_module; 50 static PyObject *const_str_angle_module;
52 static PyObject *const_str_plain_None; 51 static PyObject *const_str_plain_None;
53 static PyObject *const_str_plain_x; 52 static PyObject *const_str_plain_x;
54 extern PyObject *const_tuple_empty; 53 extern PyObject *const_tuple_empty;
55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 54 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
n 56 static PyObject *const_str_plain_python_func; n
57 static PyObject *const_int_pos_5; 55 static PyObject *const_int_pos_5;
58 static PyObject *const_str_plain_repeat; 56 static PyObject *const_str_plain_repeat;
59 static PyObject *const_int_pos_2; 57 static PyObject *const_int_pos_2;
60 static PyObject *const_tuple_none_int_pos_50000_tuple; 58 static PyObject *const_tuple_none_int_pos_50000_tuple;
61 static PyObject *const_int_pos_4; 59 static PyObject *const_int_pos_4;
70 static bool constants_created = false; 68 static bool constants_created = false;
71 69
72 /* Function to create module private constants. */ 70 /* Function to create module private constants. */
73 static void createModuleConstants( void ) 71 static void createModuleConstants( void )
74 { 72 {
n 75     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 94 ], 9, 1); n 73     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 61 ], 9, 1);
76     const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple = PyTuple_New(5); 74     const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple = PyTuple_New(5);
77     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 0, const_int_pos_1); Py_INCREF(const_int_pos_1); 75     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 0, const_int_pos_1); Py_INCREF(const_int_pos_1);
78     const_int_pos_2 = PyLong_FromUnsignedLong(2ul); 76     const_int_pos_2 = PyLong_FromUnsignedLong(2ul);
79     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 1, const_int_pos_2); Py_INCREF(const_int_pos_2); 77     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 1, const_int_pos_2); Py_INCREF(const_int_pos_2);
80     const_int_pos_3 = PyLong_FromUnsignedLong(3ul); 78     const_int_pos_3 = PyLong_FromUnsignedLong(3ul);
81     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 2, const_int_pos_3); Py_INCREF(const_int_pos_3); 79     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 2, const_int_pos_3); Py_INCREF(const_int_pos_3);
82     const_int_pos_4 = PyLong_FromUnsignedLong(4ul); 80     const_int_pos_4 = PyLong_FromUnsignedLong(4ul);
83     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 3, const_int_pos_4); Py_INCREF(const_int_pos_4); 81     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 3, const_int_pos_4); Py_INCREF(const_int_pos_4);
84     const_int_pos_5 = PyLong_FromUnsignedLong(5ul); 82     const_int_pos_5 = PyLong_FromUnsignedLong(5ul);
85     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 4, const_int_pos_5); Py_INCREF(const_int_pos_5); 83     PyTuple_SET_ITEM(const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple, 4, const_int_pos_5); Py_INCREF(const_int_pos_5);
n 86     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING_ASCII(&constant_bin[ 103 ], 40, 0); n 84     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING_ASCII(&constant_bin[ 70 ], 40, 0);
87     const_tuple_str_plain_args_tuple = PyTuple_New(1); 85     const_tuple_str_plain_args_tuple = PyTuple_New(1);
n 88     const_str_plain_args = UNSTREAM_STRING_ASCII(&constant_bin[ 143 ], 4, 1); n 86     const_str_plain_args = UNSTREAM_STRING_ASCII(&constant_bin[ 110 ], 4, 1);
89     PyTuple_SET_ITEM(const_tuple_str_plain_args_tuple, 0, const_str_plain_args); Py_INCREF(const_str_plain_args); 87     PyTuple_SET_ITEM(const_tuple_str_plain_args_tuple, 0, const_str_plain_args); Py_INCREF(const_str_plain_args);
n 90     const_tuple_int_pos_3_tuple = PyTuple_New(1); n
91     PyTuple_SET_ITEM(const_tuple_int_pos_3_tuple, 0, const_int_pos_3); Py_INCREF(const_int_pos_3);
92     const_str_plain_a = UNSTREAM_STRING_ASCII(&constant_bin[ 1 ], 1, 1); 88     const_str_plain_a = UNSTREAM_STRING_ASCII(&constant_bin[ 1 ], 1, 1);
93     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 89     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
94     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 90     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
n 95     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 147 ], 3, 0); n 91     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 114 ], 3, 0);
96     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 92     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
n 97     const_str_plain_print_function = UNSTREAM_STRING_ASCII(&constant_bin[ 150 ], 14, 1); n 93     const_str_plain_print_function = UNSTREAM_STRING_ASCII(&constant_bin[ 117 ], 14, 1);
98     const_str_digest_5de6eb7c5d282dbded1394204e46a4e6 = UNSTREAM_STRING_ASCII(&constant_bin[ 164 ], 58, 0); 94     const_str_digest_5de6eb7c5d282dbded1394204e46a4e6 = UNSTREAM_STRING_ASCII(&constant_bin[ 131 ], 58, 0);
99     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 62 ], 16, 1); 95     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 29 ], 16, 1);
100     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 222 ], 8, 0); 96     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 189 ], 8, 0);
101     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 230 ], 4, 1); 97     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 197 ], 4, 1);
102     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 214 ], 1, 1); 98     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 181 ], 1, 1);
103     const_str_plain_python_func = UNSTREAM_STRING_ASCII(&constant_bin[ 29 ], 11, 1);
104     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 234 ], 6, 1); 99     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 201 ], 6, 1);
105     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2); 100     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
106     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None); 101     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None);
107     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000); 102     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000);
n 108     const_str_angle_string = UNSTREAM_STRING_ASCII(&constant_bin[ 240 ], 8, 0); n 103     const_str_angle_string = UNSTREAM_STRING_ASCII(&constant_bin[ 207 ], 8, 0);
109     const_str_plain_exec = UNSTREAM_STRING_ASCII(&constant_bin[ 248 ], 4, 1); 104     const_str_plain_exec = UNSTREAM_STRING_ASCII(&constant_bin[ 215 ], 4, 1);
110     const_str_plain___debug__ = UNSTREAM_STRING_ASCII(&constant_bin[ 252 ], 9, 1); 105     const_str_plain___debug__ = UNSTREAM_STRING_ASCII(&constant_bin[ 219 ], 9, 1);
111 106
112     constants_created = true; 107     constants_created = true;
113 } 108 }
114 109
115 /* Function to verify module private constants for non-corruption. */ 110 /* Function to verify module private constants for non-corruption. */
135     codeobj_026232c4210fb179309ad8199ad0690c = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE); 130     codeobj_026232c4210fb179309ad8199ad0690c = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE);
136     codeobj_b7519d8b0f4a0dd92fd86eecba22e957 = MAKE_CODEOBJ(module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE); 131     codeobj_b7519d8b0f4a0dd92fd86eecba22e957 = MAKE_CODEOBJ(module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE);
137 } 132 }
138 133
139 // The module function declarations. 134 // The module function declarations.
n 140 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list(PyObject **python_pars); n
141  
142  
143 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(); 135 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly();
144 136
145 137
146 // The module function definitions. 138 // The module function definitions.
147 static PyObject *impl___main__$$$function_1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) { 139 static PyObject *impl___main__$$$function_1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) {
203         tmp_assign_source_1 = tmp_mvar_value_1; 195         tmp_assign_source_1 = tmp_mvar_value_1;
204         assert(var_args == NULL); 196         assert(var_args == NULL);
205         Py_INCREF(tmp_assign_source_1); 197         Py_INCREF(tmp_assign_source_1);
206         var_args = tmp_assign_source_1; 198         var_args = tmp_assign_source_1;
207     } 199     }
n 208     { n
209         PyObject *tmp_dircall_arg1_1;
210         PyObject *tmp_mvar_value_2;
211         PyObject *tmp_dircall_arg2_1;
212         PyObject *tmp_dircall_arg3_1;
213         PyObject *tmp_mvar_value_3;
214         PyObject *tmp_call_result_1;
215         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func);
216  
217         if (unlikely(tmp_mvar_value_2 == NULL)) {
218             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func);
219         }
220  
221         if (tmp_mvar_value_2 == NULL) {
222  
223             exception_type = PyExc_NameError;
224             Py_INCREF(exception_type);
225             exception_value = UNSTREAM_STRING(&constant_bin[ 23 ], 33, 0);
226             exception_tb = NULL;
227             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
228             CHAIN_EXCEPTION(exception_value);
229  
230             exception_lineno = 37;
231             type_description_1 = "o";
232             goto frame_exception_exit_1;
233         }
234  
235         tmp_dircall_arg1_1 = tmp_mvar_value_2;
236         tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
237         tmp_mvar_value_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_a);
238  
239         if (unlikely(tmp_mvar_value_3 == NULL)) {
240             tmp_mvar_value_3 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_a);
241         }
242  
243         if (tmp_mvar_value_3 == NULL) {
244  
245             exception_type = PyExc_NameError;
246             Py_INCREF(exception_type);
247             exception_value = UNSTREAM_STRING(&constant_bin[ 0 ], 23, 0);
248             exception_tb = NULL;
249             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
250             CHAIN_EXCEPTION(exception_value);
251  
252             exception_lineno = 37;
253             type_description_1 = "o";
254             goto frame_exception_exit_1;
255         }
256  
257         tmp_dircall_arg3_1 = tmp_mvar_value_3;
258         Py_INCREF(tmp_dircall_arg1_1);
259         Py_INCREF(tmp_dircall_arg2_1);
260         Py_INCREF(tmp_dircall_arg3_1);
261  
262         {
263             PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
264             tmp_call_result_1 = impl___internal__$$$function_1_complex_call_helper_pos_star_list(dir_call_args);
265         }
266         if (tmp_call_result_1 == NULL) {
267             assert(ERROR_OCCURRED());
268  
269             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
270  
271  
272             exception_lineno = 37;
273             type_description_1 = "o";
274             goto frame_exception_exit_1;
275         }
276         Py_DECREF(tmp_call_result_1);
277     }
278 200
279 #if 0 201 #if 0
280     RESTORE_FRAME_EXCEPTION(frame_b7519d8b0f4a0dd92fd86eecba22e957); 202     RESTORE_FRAME_EXCEPTION(frame_b7519d8b0f4a0dd92fd86eecba22e957);
281 #endif 203 #endif
282 204
342     exception_keeper_lineno_1 = exception_lineno; 264     exception_keeper_lineno_1 = exception_lineno;
343     exception_type = NULL; 265     exception_type = NULL;
344     exception_value = NULL; 266     exception_value = NULL;
345     exception_tb = NULL; 267     exception_tb = NULL;
346     exception_lineno = 0; 268     exception_lineno = 0;
n 347   n
348     Py_XDECREF(var_args);
349     var_args = NULL;
350 269
351     // Re-raise. 270     // Re-raise.
352     exception_type = exception_keeper_type_1; 271     exception_type = exception_keeper_type_1;
353     exception_value = exception_keeper_value_1; 272     exception_value = exception_keeper_value_1;
354     exception_tb = exception_keeper_tb_1; 273     exception_tb = exception_keeper_tb_1;
955 874
956         if (tmp_mvar_value_2 == NULL) { 875         if (tmp_mvar_value_2 == NULL) {
957 876
958             exception_type = PyExc_NameError; 877             exception_type = PyExc_NameError;
959             Py_INCREF(exception_type); 878             Py_INCREF(exception_type);
t 960             exception_value = UNSTREAM_STRING(&constant_bin[ 56 ], 38, 0); t 879             exception_value = UNSTREAM_STRING(&constant_bin[ 23 ], 38, 0);
961             exception_tb = NULL; 880             exception_tb = NULL;
962             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 881             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
963             CHAIN_EXCEPTION(exception_value); 882             CHAIN_EXCEPTION(exception_value);
964 883
965             exception_lineno = 44; 884             exception_lineno = 44;