Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6742191588.95192307692307257.0CPython 2.760364746242.31730769230768282.8659967123564Nuitka (master)60364290395.6826923076923282.867668047491Nuitka (develop)60365250549.0480769230769282.8641494472075Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)6903080788.95192307692307257.0CPython 3.563407010242.31730769230768277.13197902573916Nuitka (master)63158348395.6826923076923278.02213529711565Nuitka (develop)63170582549.0480769230769277.97834021855914Nuitka (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_digest_42f41cf3bb760990fea8222e6e9c3da3; 40 static PyObject *const_str_digest_42f41cf3bb760990fea8222e6e9c3da3;
42 static PyObject *const_str_plain_args; 41 static PyObject *const_str_plain_args;
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;
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_ASCII( &constant_bin[ 9 ], 40, 0 ); 83     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING_ASCII( &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_ASCII( &constant_bin[ 49 ], 4, 1 ); 85     const_str_plain_args = UNSTREAM_STRING_ASCII( &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_digest_42f41cf3bb760990fea8222e6e9c3da3 = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 84, 0 ); 87     const_str_digest_42f41cf3bb760990fea8222e6e9c3da3 = UNSTREAM_STRING_ASCII( &constant_bin[ 53 ], 84, 0 );
92     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 ); 88     const_str_plain_a = UNSTREAM_STRING_ASCII( &constant_bin[ 26 ], 1, 1 );
93     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 89     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
94     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 90     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
95     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 137 ], 3, 0 ); 91     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 137 ], 3, 0 );
97     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 14, 1 ); 93     const_str_plain_print_function = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 14, 1 );
98     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 154 ], 16, 1 ); 94     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 154 ], 16, 1 );
99     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 170 ], 8, 0 ); 95     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 170 ], 8, 0 );
100     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 178 ], 4, 1 ); 96     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 178 ], 4, 1 );
101     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 78 ], 1, 1 ); 97     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 78 ], 1, 1 );
n 102     const_str_plain_python_func = UNSTREAM_STRING_ASCII( &constant_bin[ 14 ], 11, 1 ); n
103     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 182 ], 6, 1 ); 98     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 182 ], 6, 1 );
104     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 99     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
105     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 100     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
106     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 101     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
107     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 188 ], 8, 0 ); 102     const_str_angle_string = UNSTREAM_STRING_ASCII( &constant_bin[ 188 ], 8, 0 );
134     codeobj_main = codeobj_d075664e9e881271de035e746321f271; 129     codeobj_main = codeobj_d075664e9e881271de035e746321f271;
135     codeobj_eaa3f832cd4629a4ccf8b79604babaf2 = 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_eaa3f832cd4629a4ccf8b79604babaf2 = 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 )
207     assert( var_args == NULL ); 199     assert( var_args == NULL );
208     Py_INCREF( tmp_assign_source_1 ); 200     Py_INCREF( tmp_assign_source_1 );
209     var_args = tmp_assign_source_1; 201     var_args = tmp_assign_source_1;
210 202
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_eaa3f832cd4629a4ccf8b79604babaf2 ); 206     RESTORE_FRAME_EXCEPTION( frame_eaa3f832cd4629a4ccf8b79604babaf2 );
290 #endif 207 #endif
291 208
361     exception_type = NULL; 278     exception_type = NULL;
362     exception_value = NULL; 279     exception_value = NULL;
363     exception_tb = NULL; 280     exception_tb = NULL;
364     exception_lineno = 0; 281     exception_lineno = 0;
365 282
t 366     { t
367     Py_XDECREF( var_args );
368     var_args = NULL;
369  
370     }
371     { 283     {
372     // Re-raise. 284     // Re-raise.
373     exception_type = exception_keeper_type_1; 285     exception_type = exception_keeper_type_1;
374     exception_value = exception_keeper_value_1; 286     exception_value = exception_keeper_value_1;
375     exception_tb = exception_keeper_tb_1; 287     exception_tb = exception_keeper_tb_1;