Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6364972688.95192307692307257.0CPython 2.753963793242.31730769230768294.604923211356Nuitka (master)53964048395.6826923076923294.60393319259174Nuitka (develop)53964053549.0480769230769294.60391378045915Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7143329488.95192307692307257.0CPython 3.561455081242.31730769230768291.5184969808229Nuitka (master)61455616395.6826923076923291.5166462089577Nuitka (develop)61457333549.0480769230769291.51070644205595Nuitka (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;
50 static PyObject *const_str_angle_module; 49 static PyObject *const_str_angle_module;
51 static PyObject *const_str_plain_None; 50 static PyObject *const_str_plain_None;
52 static PyObject *const_str_plain_x; 51 static PyObject *const_str_plain_x;
53 extern PyObject *const_tuple_empty; 52 extern PyObject *const_tuple_empty;
54 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 53 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
n 55 static PyObject *const_str_plain_python_func; n
56 static PyObject *const_int_pos_5; 54 static PyObject *const_int_pos_5;
57 static PyObject *const_str_plain_repeat; 55 static PyObject *const_str_plain_repeat;
58 static PyObject *const_int_pos_2; 56 static PyObject *const_int_pos_2;
59 static PyObject *const_tuple_none_int_pos_50000_tuple; 57 static PyObject *const_tuple_none_int_pos_50000_tuple;
60 static PyObject *const_str_digest_a50f8fadd2f883ab6e2551633e968a59; 58 static PyObject *const_str_digest_a50f8fadd2f883ab6e2551633e968a59;
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_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 62 ], 16, 1 ); 94     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 29 ], 16, 1 );
99     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 8, 0 ); 95     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 131 ], 8, 0 );
100     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 172 ], 4, 1 ); 96     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 139 ], 4, 1 );
101     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 176 ], 1, 1 ); 97     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 143 ], 1, 1 );
102     const_str_plain_python_func = UNSTREAM_STRING_ASCII( &constant_bin[ 29 ], 11, 1 );
103     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 177 ], 6, 1 ); 98     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 144 ], 6, 1 );
104     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 99     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
105     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF(Py_None); 100     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF(Py_None);
106     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF(const_int_pos_50000); 101     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF(const_int_pos_50000);
n 107     const_str_digest_a50f8fadd2f883ab6e2551633e968a59 = UNSTREAM_STRING_ASCII( &constant_bin[ 183 ], 58, 0 ); n 102     const_str_digest_a50f8fadd2f883ab6e2551633e968a59 = UNSTREAM_STRING_ASCII( &constant_bin[ 150 ], 58, 0 );
108     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 241 ], 8, 0 ); 103     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 208 ], 8, 0 );
109     const_str_plain_exec = UNSTREAM_STRING_ASCII( &constant_bin[ 249 ], 4, 1 ); 104     const_str_plain_exec = UNSTREAM_STRING_ASCII( &constant_bin[ 216 ], 4, 1 );
110     const_str_plain___debug__ = UNSTREAM_STRING_ASCII( &constant_bin[ 253 ], 9, 1 ); 105     const_str_plain___debug__ = UNSTREAM_STRING_ASCII( &constant_bin[ 220 ], 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_5551848ddf28a65c1dc39b8a0f571c1c = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 130     codeobj_5551848ddf28a65c1dc39b8a0f571c1c = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
136     codeobj_5f2270f4751330fe6dbc044a10d04411 = 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_5f2270f4751330fe6dbc044a10d04411 = 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 )
205         tmp_assign_source_1 = tmp_mvar_value_1; 197         tmp_assign_source_1 = tmp_mvar_value_1;
206         assert(var_args == NULL); 198         assert(var_args == NULL);
207         Py_INCREF(tmp_assign_source_1); 199         Py_INCREF(tmp_assign_source_1);
208         var_args = tmp_assign_source_1; 200         var_args = tmp_assign_source_1;
209     } 201     }
n 210     { n
211         PyObject *tmp_dircall_arg1_1;
212         PyObject *tmp_mvar_value_2;
213         PyObject *tmp_dircall_arg2_1;
214         PyObject *tmp_dircall_arg3_1;
215         PyObject *tmp_mvar_value_3;
216         PyObject *tmp_call_result_1;
217         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func);
218  
219         if (unlikely( tmp_mvar_value_2 == NULL )) {
220             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func);
221         }
222  
223         if ( tmp_mvar_value_2 == NULL )
224         {
225  
226             exception_type = PyExc_NameError;
227             Py_INCREF(exception_type);
228             exception_value = UNSTREAM_STRING( &constant_bin[ 23 ], 33, 0 );
229             exception_tb = NULL;
230             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
231             CHAIN_EXCEPTION( exception_value );
232  
233             exception_lineno = 37;
234             type_description_1 = "o";
235             goto frame_exception_exit_1;
236         }
237  
238         tmp_dircall_arg1_1 = tmp_mvar_value_2;
239         tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
240         tmp_mvar_value_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_a);
241  
242         if (unlikely( tmp_mvar_value_3 == NULL )) {
243             tmp_mvar_value_3 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_a);
244         }
245  
246         if ( tmp_mvar_value_3 == NULL )
247         {
248  
249             exception_type = PyExc_NameError;
250             Py_INCREF(exception_type);
251             exception_value = UNSTREAM_STRING( &constant_bin[ 0 ], 23, 0 );
252             exception_tb = NULL;
253             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
254             CHAIN_EXCEPTION( exception_value );
255  
256             exception_lineno = 37;
257             type_description_1 = "o";
258             goto frame_exception_exit_1;
259         }
260  
261         tmp_dircall_arg3_1 = tmp_mvar_value_3;
262         Py_INCREF(tmp_dircall_arg1_1);
263         Py_INCREF(tmp_dircall_arg2_1);
264         Py_INCREF(tmp_dircall_arg3_1);
265  
266         {
267             PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
268             tmp_call_result_1 = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
269         }
270         if ( tmp_call_result_1 == NULL )
271         {
272             assert(ERROR_OCCURRED());
273  
274             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
275  
276  
277             exception_lineno = 37;
278             type_description_1 = "o";
279             goto frame_exception_exit_1;
280         }
281         Py_DECREF(tmp_call_result_1);
282     }
283 202
284 #if 0 203 #if 0
285     RESTORE_FRAME_EXCEPTION(frame_5f2270f4751330fe6dbc044a10d04411); 204     RESTORE_FRAME_EXCEPTION(frame_5f2270f4751330fe6dbc044a10d04411);
286 #endif 205 #endif
287 206
347     exception_keeper_lineno_1 = exception_lineno; 266     exception_keeper_lineno_1 = exception_lineno;
348     exception_type = NULL; 267     exception_type = NULL;
349     exception_value = NULL; 268     exception_value = NULL;
350     exception_tb = NULL; 269     exception_tb = NULL;
351     exception_lineno = 0; 270     exception_lineno = 0;
n 352   n
353     Py_XDECREF(var_args);
354     var_args = NULL;
355 271
356     // Re-raise. 272     // Re-raise.
357     exception_type = exception_keeper_type_1; 273     exception_type = exception_keeper_type_1;
358     exception_value = exception_keeper_value_1; 274     exception_value = exception_keeper_value_1;
359     exception_tb = exception_keeper_tb_1; 275     exception_tb = exception_keeper_tb_1;
967         if ( tmp_mvar_value_2 == NULL ) 883         if ( tmp_mvar_value_2 == NULL )
968         { 884         {
969 885
970             exception_type = PyExc_NameError; 886             exception_type = PyExc_NameError;
971             Py_INCREF(exception_type); 887             Py_INCREF(exception_type);
t 972             exception_value = UNSTREAM_STRING( &constant_bin[ 56 ], 38, 0 ); t 888             exception_value = UNSTREAM_STRING( &constant_bin[ 23 ], 38, 0 );
973             exception_tb = NULL; 889             exception_tb = NULL;
974             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 890             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
975             CHAIN_EXCEPTION( exception_value ); 891             CHAIN_EXCEPTION( exception_value );
976 892
977             exception_lineno = 44; 893             exception_lineno = 44;