Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6642151188.95192307692307257.0CPython 2.757863630242.31730769230768288.8388429135208Nuitka (master)57863228395.6826923076923288.8403385191329Nuitka (develop)57863637549.0480769230769288.838816870637Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)6937944688.95192307692307257.00000000000006CPython 3.563106088242.31730769230768279.34441703382873Nuitka (master)63105223395.6826923076923279.34749798676245Nuitka (develop)63106721549.0480769230769279.34216241740444Nuitka (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;
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 ); 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 );
87     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 40, 0 ); 85     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 40, 0 );
88     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 86     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
89     const_str_plain_args = UNSTREAM_STRING_ASCII( &constant_bin[ 49 ], 4, 1 ); 87     const_str_plain_args = UNSTREAM_STRING_ASCII( &constant_bin[ 49 ], 4, 1 );
90     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 88     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 91     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
92     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
93     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 ); 89     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 );
94     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 90     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
95     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 91     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
96     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 3, 0 ); 92     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 3, 0 );
97     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 93     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
99     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 70 ], 16, 1 ); 95     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 70 ], 16, 1 );
100     const_str_digest_e361f0521efa59b411109e5c19b9f317 = UNSTREAM_STRING_ASCII( &constant_bin[ 86 ], 84, 0 ); 96     const_str_digest_e361f0521efa59b411109e5c19b9f317 = UNSTREAM_STRING_ASCII( &constant_bin[ 86 ], 84, 0 );
101     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 170 ], 8, 0 ); 97     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 170 ], 8, 0 );
102     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 178 ], 4, 1 ); 98     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 178 ], 4, 1 );
103     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 111 ], 1, 1 ); 99     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 111 ], 1, 1 );
n 104     const_str_plain_python_func = UNSTREAM_STRING_ASCII( &constant_bin[ 14 ], 11, 1 ); n
105     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 182 ], 6, 1 ); 100     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 182 ], 6, 1 );
106     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 101     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
107     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 102     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
108     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 103     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
109     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 188 ], 8, 0 ); 104     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 188 ], 8, 0 );
136     codeobj_01f910018e07ecde3f34011a4b74bac9 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 131     codeobj_01f910018e07ecde3f34011a4b74bac9 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
137     codeobj_3af31ca9d5fcb688297b68588f80f10a = 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_3af31ca9d5fcb688297b68588f80f10a = 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 )
207         tmp_assign_source_1 = tmp_mvar_value_1; 199         tmp_assign_source_1 = tmp_mvar_value_1;
208         assert( var_args == NULL ); 200         assert( var_args == NULL );
209         Py_INCREF( tmp_assign_source_1 ); 201         Py_INCREF( tmp_assign_source_1 );
210         var_args = tmp_assign_source_1; 202         var_args = tmp_assign_source_1;
211     } 203     }
n 212     { n
213         PyObject *tmp_dircall_arg1_1;
214         PyObject *tmp_mvar_value_2;
215         PyObject *tmp_dircall_arg2_1;
216         PyObject *tmp_dircall_arg3_1;
217         PyObject *tmp_mvar_value_3;
218         PyObject *tmp_call_result_1;
219         tmp_mvar_value_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func );
220  
221         if (unlikely( tmp_mvar_value_2 == NULL ))
222         {
223             tmp_mvar_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
224         }
225  
226         if ( tmp_mvar_value_2 == NULL )
227         {
228  
229             exception_type = PyExc_NameError;
230             Py_INCREF( exception_type );
231             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
232             exception_tb = NULL;
233             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
234             CHAIN_EXCEPTION( exception_value );
235  
236             exception_lineno = 37;
237             type_description_1 = "o";
238             goto frame_exception_exit_1;
239         }
240  
241         tmp_dircall_arg1_1 = tmp_mvar_value_2;
242         tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
243         tmp_mvar_value_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
244  
245         if (unlikely( tmp_mvar_value_3 == NULL ))
246         {
247             tmp_mvar_value_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
248         }
249  
250         if ( tmp_mvar_value_3 == NULL )
251         {
252  
253             exception_type = PyExc_NameError;
254             Py_INCREF( exception_type );
255             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
256             exception_tb = NULL;
257             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
258             CHAIN_EXCEPTION( exception_value );
259  
260             exception_lineno = 37;
261             type_description_1 = "o";
262             goto frame_exception_exit_1;
263         }
264  
265         tmp_dircall_arg3_1 = tmp_mvar_value_3;
266         Py_INCREF( tmp_dircall_arg1_1 );
267         Py_INCREF( tmp_dircall_arg2_1 );
268         Py_INCREF( tmp_dircall_arg3_1 );
269  
270         {
271             PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
272             tmp_call_result_1 = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
273         }
274         if ( tmp_call_result_1 == NULL )
275         {
276             assert( ERROR_OCCURRED() );
277  
278             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
279  
280  
281             exception_lineno = 37;
282             type_description_1 = "o";
283             goto frame_exception_exit_1;
284         }
285         Py_DECREF( tmp_call_result_1 );
286     }
287 204
288 #if 0 205 #if 0
289     RESTORE_FRAME_EXCEPTION( frame_3af31ca9d5fcb688297b68588f80f10a ); 206     RESTORE_FRAME_EXCEPTION( frame_3af31ca9d5fcb688297b68588f80f10a );
290 #endif 207 #endif
291 208
354     exception_keeper_lineno_1 = exception_lineno; 271     exception_keeper_lineno_1 = exception_lineno;
355     exception_type = NULL; 272     exception_type = NULL;
356     exception_value = NULL; 273     exception_value = NULL;
357     exception_tb = NULL; 274     exception_tb = NULL;
358     exception_lineno = 0; 275     exception_lineno = 0;
t 359   t
360     Py_XDECREF( var_args );
361     var_args = NULL;
362 276
363     // Re-raise. 277     // Re-raise.
364     exception_type = exception_keeper_type_1; 278     exception_type = exception_keeper_type_1;
365     exception_value = exception_keeper_value_1; 279     exception_value = exception_keeper_value_1;
366     exception_tb = exception_keeper_tb_1; 280     exception_tb = exception_keeper_tb_1;