Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6286922188.95192307692307257.0CPython 2.759612260242.31730769230768269.80189506709985Nuitka (master)59614854395.6826923076923269.7916990236704Nuitka (develop)59614848549.0480769230769269.7917226074254Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7253275688.95192307692307257.00000000000006CPython 3.562715217242.31730769230768290.4478525255754Nuitka (master)62709784395.6826923076923290.46636247830094Nuitka (develop)62710087549.0480769230769290.46533017282036Nuitka (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
36 static PyObject *const_str_plain___spec__; 36 static PyObject *const_str_plain___spec__;
37 static PyObject *const_str_digest_81ebfe46b58d4a2dd9ca447b318cd0b2; 37 static PyObject *const_str_digest_81ebfe46b58d4a2dd9ca447b318cd0b2;
38 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple; 38 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple;
39 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d; 39 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d;
40 static PyObject *const_tuple_str_plain_args_tuple; 40 static PyObject *const_tuple_str_plain_args_tuple;
n 41 static PyObject *const_tuple_int_pos_3_tuple; n
42 extern PyObject *const_int_pos_1; 41 extern PyObject *const_int_pos_1;
43 extern PyObject *const_dict_empty; 42 extern PyObject *const_dict_empty;
44 extern PyObject *const_str_plain___file__; 43 extern PyObject *const_str_plain___file__;
45 static PyObject *const_str_plain_args; 44 static PyObject *const_str_plain_args;
46 extern PyObject *const_int_0; 45 extern PyObject *const_int_0;
53 static PyObject *const_str_plain_calledRepeatedly; 52 static PyObject *const_str_plain_calledRepeatedly;
54 static PyObject *const_str_angle_module; 53 static PyObject *const_str_angle_module;
55 static PyObject *const_str_plain_x; 54 static PyObject *const_str_plain_x;
56 extern PyObject *const_tuple_empty; 55 extern PyObject *const_tuple_empty;
57 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 56 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
n 58 static PyObject *const_str_plain_python_func; n
59 static PyObject *const_int_pos_5; 57 static PyObject *const_int_pos_5;
60 static PyObject *const_str_plain_repeat; 58 static PyObject *const_str_plain_repeat;
61 static PyObject *const_int_pos_2; 59 static PyObject *const_int_pos_2;
62 static PyObject *const_tuple_none_int_pos_50000_tuple; 60 static PyObject *const_tuple_none_int_pos_50000_tuple;
63 static PyObject *const_int_pos_4; 61 static PyObject *const_int_pos_4;
89     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 ); 87     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 );
90     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 119 ], 40, 0 ); 88     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 119 ], 40, 0 );
91     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 89     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
92     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 159 ], 4, 1 ); 90     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 159 ], 4, 1 );
93     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 91     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 94     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
95     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
96     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 12 ], 1, 1 ); 92     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 12 ], 1, 1 );
97     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 93     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
98     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 94     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
99     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 163 ], 3, 0 ); 95     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 163 ], 3, 0 );
100     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 96     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
101     const_str_plain_print_function = UNSTREAM_STRING( &constant_bin[ 166 ], 14, 1 ); 97     const_str_plain_print_function = UNSTREAM_STRING( &constant_bin[ 166 ], 14, 1 );
102     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 180 ], 16, 1 ); 98     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 180 ], 16, 1 );
103     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 196 ], 8, 0 ); 99     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 196 ], 8, 0 );
104     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 ); 100     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 );
n 105     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 124 ], 11, 1 ); n
106     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 204 ], 6, 1 ); 101     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 204 ], 6, 1 );
107     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 102     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
108     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 103     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
109     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 104     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
110     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 210 ], 8, 0 ); 105     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 210 ], 8, 0 );
136     codeobj_main = codeobj_9b8fe01b21f64843d81419806ce955cf; 131     codeobj_main = codeobj_9b8fe01b21f64843d81419806ce955cf;
137     codeobj_0150debb643b1c906cc84608d29a4872 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 132     codeobj_0150debb643b1c906cc84608d29a4872 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
138 } 133 }
139 134
140 // The module function declarations. 135 // The module function declarations.
n 141 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list( PyObject **python_pars ); n
142  
143  
144 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 136 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
145 137
146 138
147 // The module function definitions. 139 // The module function definitions.
148 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 140 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
161     PyObject *exception_keeper_type_1; 153     PyObject *exception_keeper_type_1;
162     PyObject *exception_keeper_value_1; 154     PyObject *exception_keeper_value_1;
163     PyTracebackObject *exception_keeper_tb_1; 155     PyTracebackObject *exception_keeper_tb_1;
164     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 156     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
165     PyObject *tmp_assign_source_1; 157     PyObject *tmp_assign_source_1;
n 166     PyObject *tmp_dircall_arg1_1; n
167     PyObject *tmp_dircall_arg2_1;
168     PyObject *tmp_dircall_arg3_1;
169     PyObject *tmp_return_value; 158     PyObject *tmp_return_value;
n 170     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
171     static struct Nuitka_FrameObject *cache_frame_0150debb643b1c906cc84608d29a4872 = NULL; 159     static struct Nuitka_FrameObject *cache_frame_0150debb643b1c906cc84608d29a4872 = NULL;
172 160
173     struct Nuitka_FrameObject *frame_0150debb643b1c906cc84608d29a4872; 161     struct Nuitka_FrameObject *frame_0150debb643b1c906cc84608d29a4872;
174 162
175     char const *type_description; 163     char const *type_description;
211 199
212     assert( var_args == NULL ); 200     assert( var_args == NULL );
213     Py_INCREF( tmp_assign_source_1 ); 201     Py_INCREF( tmp_assign_source_1 );
214     var_args = tmp_assign_source_1; 202     var_args = tmp_assign_source_1;
215 203
n 216     tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func ); n
217  
218     if (unlikely( tmp_dircall_arg1_1 == NULL ))
219     {
220         tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
221     }
222  
223     if ( tmp_dircall_arg1_1 == NULL )
224     {
225  
226         exception_type = PyExc_NameError;
227         Py_INCREF( exception_type );
228         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
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 = "o";
235         goto frame_exception_exit_1;
236     }
237  
238     tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
239     tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
240  
241     if (unlikely( tmp_dircall_arg3_1 == NULL ))
242     {
243         tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
244     }
245  
246     if ( tmp_dircall_arg3_1 == NULL )
247     {
248  
249         exception_type = PyExc_NameError;
250         Py_INCREF( exception_type );
251         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
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 = "o";
258         goto frame_exception_exit_1;
259     }
260  
261     Py_INCREF( tmp_dircall_arg1_1 );
262     Py_INCREF( tmp_dircall_arg2_1 );
263     Py_INCREF( tmp_dircall_arg3_1 );
264  
265     {
266         PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
267         tmp_unused = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
268     }
269     if ( tmp_unused == NULL )
270     {
271         assert( ERROR_OCCURRED() );
272  
273         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
274  
275  
276         exception_lineno = 37;
277         type_description = "o";
278         goto frame_exception_exit_1;
279     }
280     Py_DECREF( tmp_unused );
281 204
282 #if 0 205 #if 0
283     RESTORE_FRAME_EXCEPTION( frame_0150debb643b1c906cc84608d29a4872 ); 206     RESTORE_FRAME_EXCEPTION( frame_0150debb643b1c906cc84608d29a4872 );
284 #endif 207 #endif
285 208
344     exception_keeper_lineno_1 = exception_lineno; 267     exception_keeper_lineno_1 = exception_lineno;
345     exception_type = NULL; 268     exception_type = NULL;
346     exception_value = NULL; 269     exception_value = NULL;
347     exception_tb = NULL; 270     exception_tb = NULL;
348     exception_lineno = 0; 271     exception_lineno = 0;
t 349   t
350     Py_XDECREF( var_args );
351     var_args = NULL;
352 272
353     // Re-raise. 273     // Re-raise.
354     exception_type = exception_keeper_type_1; 274     exception_type = exception_keeper_type_1;
355     exception_value = exception_keeper_value_1; 275     exception_value = exception_keeper_value_1;
356     exception_tb = exception_keeper_tb_1; 276     exception_tb = exception_keeper_tb_1;