Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6742191588.95192307692307257.0CPython 2.760365090242.31730769230768282.8647358805881Nuitka (master)60366018395.6826923076923282.86133456698076Nuitka (develop)60364826549.0480769230769282.8657034956661Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)6903080788.95192307692307257.0CPython 3.563460762242.31730769230768276.9395584713359Nuitka (master)63477305395.6826923076923276.8803381031357Nuitka (develop)63461903549.0480769230769276.93547393768927Nuitka (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 module constants used, if any. */ 33 /* The 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;
52 static PyObject *const_str_plain_None; 51 static PyObject *const_str_plain_None;
53 static PyObject *const_str_digest_e64cb1d0169bb9f2859d4c9fdab4afe3; 52 static PyObject *const_str_digest_e64cb1d0169bb9f2859d4c9fdab4afe3;
54 static PyObject *const_str_plain_x; 53 static PyObject *const_str_plain_x;
55 extern PyObject *const_tuple_empty; 54 extern PyObject *const_tuple_empty;
56 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
n 57 static PyObject *const_str_plain_python_func; n
58 static PyObject *const_int_pos_5; 56 static PyObject *const_int_pos_5;
59 static PyObject *const_str_plain_repeat; 57 static PyObject *const_str_plain_repeat;
60 static PyObject *const_int_pos_2; 58 static PyObject *const_int_pos_2;
61 static PyObject *const_tuple_none_int_pos_50000_tuple; 59 static PyObject *const_tuple_none_int_pos_50000_tuple;
62 static PyObject *const_int_pos_4; 60 static PyObject *const_int_pos_4;
84     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 ); 82     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 );
85     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 9 ], 40, 0 ); 83     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 9 ], 40, 0 );
86     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 84     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
87     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 49 ], 4, 1 ); 85     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 49 ], 4, 1 );
88     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 86     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 89     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
90     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
91     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 26 ], 1, 1 ); 87     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 26 ], 1, 1 );
92     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 88     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
93     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 89     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
94     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 53 ], 3, 0 ); 90     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 53 ], 3, 0 );
95     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 91     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
98     const_str_plain_True = UNSTREAM_STRING( &constant_bin[ 86 ], 4, 1 ); 94     const_str_plain_True = UNSTREAM_STRING( &constant_bin[ 86 ], 4, 1 );
99     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 90 ], 8, 0 ); 95     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 90 ], 8, 0 );
100     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 98 ], 4, 1 ); 96     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 98 ], 4, 1 );
101     const_str_digest_e64cb1d0169bb9f2859d4c9fdab4afe3 = UNSTREAM_STRING( &constant_bin[ 102 ], 91, 0 ); 97     const_str_digest_e64cb1d0169bb9f2859d4c9fdab4afe3 = UNSTREAM_STRING( &constant_bin[ 102 ], 91, 0 );
102     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 127 ], 1, 1 ); 98     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 127 ], 1, 1 );
n 103     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 14 ], 11, 1 ); n
104     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 193 ], 6, 1 ); 99     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 193 ], 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 );
108     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 199 ], 8, 0 ); 103     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 199 ], 8, 0 );
134     codeobj_main = codeobj_a8d6b748d685ba4eab4aa5ffac64d028; 129     codeobj_main = codeobj_a8d6b748d685ba4eab4aa5ffac64d028;
135     codeobj_aaa37a804752c8190490e601fb5b8c7c = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 130     codeobj_aaa37a804752c8190490e601fb5b8c7c = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
136 } 131 }
137 132
138 // The module function declarations. 133 // The module function declarations.
n 139 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list( PyObject **python_pars ); n
140  
141  
142 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 134 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
143 135
144 136
145 // The module function definitions. 137 // The module function definitions.
146 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 138 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
156     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 148     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
157     PyObject *exception_type = NULL; 149     PyObject *exception_type = NULL;
158     PyObject *exception_value = NULL; 150     PyObject *exception_value = NULL;
159     PyTracebackObject *exception_tb = NULL; 151     PyTracebackObject *exception_tb = NULL;
160     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 152     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 161     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
162     static struct Nuitka_FrameObject *cache_frame_aaa37a804752c8190490e601fb5b8c7c = NULL; 153     static struct Nuitka_FrameObject *cache_frame_aaa37a804752c8190490e601fb5b8c7c = NULL;
163     PyObject *tmp_return_value = NULL; 154     PyObject *tmp_return_value = NULL;
164     PyObject *exception_keeper_type_1; 155     PyObject *exception_keeper_type_1;
165     PyObject *exception_keeper_value_1; 156     PyObject *exception_keeper_value_1;
166     PyTracebackObject *exception_keeper_tb_1; 157     PyTracebackObject *exception_keeper_tb_1;
205 196
206     assert( var_args == NULL ); 197     assert( var_args == NULL );
207     Py_INCREF( tmp_assign_source_1 ); 198     Py_INCREF( tmp_assign_source_1 );
208     var_args = tmp_assign_source_1; 199     var_args = tmp_assign_source_1;
209 200
n 210     } n
211     {
212     PyObject *tmp_dircall_arg1_1;
213     PyObject *tmp_dircall_arg2_1;
214     PyObject *tmp_dircall_arg3_1;
215     tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func );
216  
217     if (unlikely( tmp_dircall_arg1_1 == NULL ))
218     {
219         tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
220     }
221  
222     if ( tmp_dircall_arg1_1 == NULL )
223     {
224  
225         exception_type = PyExc_NameError;
226         Py_INCREF( exception_type );
227         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
228         exception_tb = NULL;
229         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
230         CHAIN_EXCEPTION( exception_value );
231  
232         exception_lineno = 37;
233         type_description_1 = "o";
234         goto frame_exception_exit_1;
235     }
236  
237     tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
238     tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
239  
240     if (unlikely( tmp_dircall_arg3_1 == NULL ))
241     {
242         tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
243     }
244  
245     if ( tmp_dircall_arg3_1 == NULL )
246     {
247  
248         exception_type = PyExc_NameError;
249         Py_INCREF( exception_type );
250         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
251         exception_tb = NULL;
252         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
253         CHAIN_EXCEPTION( exception_value );
254  
255         exception_lineno = 37;
256         type_description_1 = "o";
257         goto frame_exception_exit_1;
258     }
259  
260     Py_INCREF( tmp_dircall_arg1_1 );
261     Py_INCREF( tmp_dircall_arg2_1 );
262     Py_INCREF( tmp_dircall_arg3_1 );
263  
264     {
265         PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
266         tmp_unused = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
267     }
268     if ( tmp_unused == NULL )
269     {
270         assert( ERROR_OCCURRED() );
271  
272         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
273  
274  
275         exception_lineno = 37;
276         type_description_1 = "o";
277         goto frame_exception_exit_1;
278     }
279     Py_DECREF( tmp_unused );
280     } 201     }
281 202
282 #if 0 203 #if 0
283     RESTORE_FRAME_EXCEPTION( frame_aaa37a804752c8190490e601fb5b8c7c ); 204     RESTORE_FRAME_EXCEPTION( frame_aaa37a804752c8190490e601fb5b8c7c );
284 #endif 205 #endif
356     exception_type = NULL; 277     exception_type = NULL;
357     exception_value = NULL; 278     exception_value = NULL;
358     exception_tb = NULL; 279     exception_tb = NULL;
359     exception_lineno = 0; 280     exception_lineno = 0;
360 281
t 361     { t
362     Py_XDECREF( var_args );
363     var_args = NULL;
364  
365     }
366     { 282     {
367     // Re-raise. 283     // Re-raise.
368     exception_type = exception_keeper_type_1; 284     exception_type = exception_keeper_type_1;
369     exception_value = exception_keeper_value_1; 285     exception_value = exception_keeper_value_1;
370     exception_tb = exception_keeper_tb_1; 286     exception_tb = exception_keeper_tb_1;