Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6286922188.95192307692307257.0CPython 2.759614038242.31730769230768269.794906414356Nuitka (master)59614681395.6826923076923269.79237902194075Nuitka (develop)59614591549.0480769230769269.7927327782663Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7253275688.95192307692307257.00000000000006CPython 3.562704934242.31730769230768290.4828861798874Nuitka (master)62704240395.6826923076923290.4852506023411Nuitka (develop)62706190549.0480769230769290.47860705221876Nuitka (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
35 static PyObject *const_str_plain___package__; 35 static PyObject *const_str_plain___package__;
36 static PyObject *const_str_plain___spec__; 36 static PyObject *const_str_plain___spec__;
37 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple; 37 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple;
38 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d; 38 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d;
39 static PyObject *const_tuple_str_plain_args_tuple; 39 static PyObject *const_tuple_str_plain_args_tuple;
n 40 static PyObject *const_tuple_int_pos_3_tuple; n
41 static PyObject *const_str_digest_c670d4769a3a0cc83a59b235dfa95173; 40 static PyObject *const_str_digest_c670d4769a3a0cc83a59b235dfa95173;
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;
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;
88     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 ); 86     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 );
89     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 28 ], 40, 0 ); 87     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 28 ], 40, 0 );
90     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 88     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
91     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 68 ], 4, 1 ); 89     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 68 ], 4, 1 );
92     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 90     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 93     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
94     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
95     const_str_digest_c670d4769a3a0cc83a59b235dfa95173 = UNSTREAM_STRING( &constant_bin[ 72 ], 91, 0 ); 91     const_str_digest_c670d4769a3a0cc83a59b235dfa95173 = UNSTREAM_STRING( &constant_bin[ 72 ], 91, 0 );
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[ 97 ], 1, 1 ); 100     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 97 ], 1, 1 );
n 105     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 33 ], 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_4928c2b4ce8f322ff643d629a3cc9ffc; 131     codeobj_main = codeobj_4928c2b4ce8f322ff643d629a3cc9ffc;
137     codeobj_80558d02b67d884cd836e0d945075341 = 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_80558d02b67d884cd836e0d945075341 = 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_80558d02b67d884cd836e0d945075341 = NULL; 159     static struct Nuitka_FrameObject *cache_frame_80558d02b67d884cd836e0d945075341 = NULL;
172 160
173     struct Nuitka_FrameObject *frame_80558d02b67d884cd836e0d945075341; 161     struct Nuitka_FrameObject *frame_80558d02b67d884cd836e0d945075341;
174 162
175     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 163     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
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_1 = "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_1 = "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_1 = "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_80558d02b67d884cd836e0d945075341 ); 206     RESTORE_FRAME_EXCEPTION( frame_80558d02b67d884cd836e0d945075341 );
284 #endif 207 #endif
285 208
349     exception_keeper_lineno_1 = exception_lineno; 272     exception_keeper_lineno_1 = exception_lineno;
350     exception_type = NULL; 273     exception_type = NULL;
351     exception_value = NULL; 274     exception_value = NULL;
352     exception_tb = NULL; 275     exception_tb = NULL;
353     exception_lineno = 0; 276     exception_lineno = 0;
t 354   t
355     Py_XDECREF( var_args );
356     var_args = NULL;
357 277
358     // Re-raise. 278     // Re-raise.
359     exception_type = exception_keeper_type_1; 279     exception_type = exception_keeper_type_1;
360     exception_value = exception_keeper_value_1; 280     exception_value = exception_keeper_value_1;
361     exception_tb = exception_keeper_tb_1; 281     exception_tb = exception_keeper_tb_1;