Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6642164688.95192307692307257.00000000000006CPython 2.760361969242.31730769230768279.5444490264514Nuitka (master)60364968395.6826923076923279.53329153362955Nuitka (develop)60363956549.0480769230769279.5370565828912Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)6937939888.95192307692307257.0CPython 3.563151131242.31730769230768279.1838274698248Nuitka (master)63145182395.6826923076923279.20501660471865Nuitka (develop)63145120549.0480769230769279.20523743617997Nuitka (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 static PyObject *const_str_digest_62f00f853482be7b9a460e88575a71ab; 41 static PyObject *const_str_digest_62f00f853482be7b9a460e88575a71ab;
43 extern PyObject *const_int_0; 42 extern PyObject *const_int_0;
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_digest_62f00f853482be7b9a460e88575a71ab = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 84, 0 ); 89     const_str_digest_62f00f853482be7b9a460e88575a71ab = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 84, 0 );
94     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 ); 90     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 );
95     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 91     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
96     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 92     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
97     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 137 ], 3, 0 ); 93     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 137 ], 3, 0 );
99     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 14, 1 ); 95     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 14, 1 );
100     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 154 ], 16, 1 ); 96     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 154 ], 16, 1 );
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[ 78 ], 1, 1 ); 99     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 78 ], 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 );
137     codeobj_main = codeobj_8939dcace59dd982f8614425df3a43e8; 132     codeobj_main = codeobj_8939dcace59dd982f8614425df3a43e8;
138     codeobj_f0c6fad4aea261e03f4e3546f73318d6 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 133     codeobj_f0c6fad4aea261e03f4e3546f73318d6 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
139 } 134 }
140 135
141 // The module function declarations. 136 // The module function declarations.
n 142 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list( PyObject **python_pars ); n
143  
144  
145 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 137 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
146 138
147 139
148 // The module function definitions. 140 // The module function definitions.
149 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 141 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
208         tmp_assign_source_1 = tmp_mvar_value_1; 200         tmp_assign_source_1 = tmp_mvar_value_1;
209         assert( var_args == NULL ); 201         assert( var_args == NULL );
210         Py_INCREF( tmp_assign_source_1 ); 202         Py_INCREF( tmp_assign_source_1 );
211         var_args = tmp_assign_source_1; 203         var_args = tmp_assign_source_1;
212     } 204     }
n 213     { n
214         PyObject *tmp_dircall_arg1_1;
215         PyObject *tmp_mvar_value_2;
216         PyObject *tmp_dircall_arg2_1;
217         PyObject *tmp_dircall_arg3_1;
218         PyObject *tmp_mvar_value_3;
219         PyObject *tmp_call_result_1;
220         tmp_mvar_value_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func );
221  
222         if (unlikely( tmp_mvar_value_2 == NULL ))
223         {
224             tmp_mvar_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
225         }
226  
227         if ( tmp_mvar_value_2 == NULL )
228         {
229  
230             exception_type = PyExc_NameError;
231             Py_INCREF( exception_type );
232             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
233             exception_tb = NULL;
234             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
235             CHAIN_EXCEPTION( exception_value );
236  
237             exception_lineno = 37;
238             type_description_1 = "o";
239             goto frame_exception_exit_1;
240         }
241  
242         tmp_dircall_arg1_1 = tmp_mvar_value_2;
243         tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
244         tmp_mvar_value_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
245  
246         if (unlikely( tmp_mvar_value_3 == NULL ))
247         {
248             tmp_mvar_value_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
249         }
250  
251         if ( tmp_mvar_value_3 == NULL )
252         {
253  
254             exception_type = PyExc_NameError;
255             Py_INCREF( exception_type );
256             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
257             exception_tb = NULL;
258             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
259             CHAIN_EXCEPTION( exception_value );
260  
261             exception_lineno = 37;
262             type_description_1 = "o";
263             goto frame_exception_exit_1;
264         }
265  
266         tmp_dircall_arg3_1 = tmp_mvar_value_3;
267         Py_INCREF( tmp_dircall_arg1_1 );
268         Py_INCREF( tmp_dircall_arg2_1 );
269         Py_INCREF( tmp_dircall_arg3_1 );
270  
271         {
272             PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
273             tmp_call_result_1 = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
274         }
275         if ( tmp_call_result_1 == NULL )
276         {
277             assert( ERROR_OCCURRED() );
278  
279             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
280  
281  
282             exception_lineno = 37;
283             type_description_1 = "o";
284             goto frame_exception_exit_1;
285         }
286         Py_DECREF( tmp_call_result_1 );
287     }
288 205
289 #if 0 206 #if 0
290     RESTORE_FRAME_EXCEPTION( frame_f0c6fad4aea261e03f4e3546f73318d6 ); 207     RESTORE_FRAME_EXCEPTION( frame_f0c6fad4aea261e03f4e3546f73318d6 );
291 #endif 208 #endif
292 209
355     exception_keeper_lineno_1 = exception_lineno; 272     exception_keeper_lineno_1 = exception_lineno;
356     exception_type = NULL; 273     exception_type = NULL;
357     exception_value = NULL; 274     exception_value = NULL;
358     exception_tb = NULL; 275     exception_tb = NULL;
359     exception_lineno = 0; 276     exception_lineno = 0;
t 360   t
361     Py_XDECREF( var_args );
362     var_args = NULL;
363 277
364     // Re-raise. 278     // Re-raise.
365     exception_type = exception_keeper_type_1; 279     exception_type = exception_keeper_type_1;
366     exception_value = exception_keeper_value_1; 280     exception_value = exception_keeper_value_1;
367     exception_tb = exception_keeper_tb_1; 281     exception_tb = exception_keeper_tb_1;