Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)6275490873.61538461538461257.0CPython 2.761967046196.30769230769232260.10243178356416Nuitka (historic)61513930319.0000000000001261.8867055269881Nuitka (master)61514744441.69230769230774261.88350016935976Nuitka (develop)61514107564.3846153846155261.8860085389043Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)7253297473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)64770446319.0000000000001283.44645581894514Nuitka (master)64758657441.69230769230774283.48662021740523Nuitka (develop)64776334564.3846153846155283.42639576481565Nuitka (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



for x in xrange(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

for x in xrange(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 for x in xrange(50000): 42 for x in xrange(50000):
43     calledRepeatedly() 43     calledRepeatedly()
44 44
45 print("OK.") 45 print("OK.")

Context Diff of Generated Code


Construct
Baseline
34 static PyObject *const_str_digest_ac2b1b49d60183836993115496ab1323; 34 static PyObject *const_str_digest_ac2b1b49d60183836993115496ab1323;
35 static PyObject *const_str_plain___package__; 35 static PyObject *const_str_plain___package__;
36 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple; 36 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_int_pos_4_int_pos_5_tuple;
37 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d; 37 static PyObject *const_str_digest_40641b58ed6f61cc974b85218932eb8d;
38 static PyObject *const_tuple_str_plain_args_tuple; 38 static PyObject *const_tuple_str_plain_args_tuple;
n 39 static PyObject *const_tuple_int_pos_3_tuple; n
40 extern PyObject *const_int_pos_1; 39 extern PyObject *const_int_pos_1;
41 extern PyObject *const_dict_empty; 40 extern PyObject *const_dict_empty;
42 extern PyObject *const_str_plain___file__; 41 extern PyObject *const_str_plain___file__;
43 static PyObject *const_str_plain_args; 42 static PyObject *const_str_plain_args;
44 extern PyObject *const_int_0; 43 extern PyObject *const_int_0;
51 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_str_angle_module; 51 static PyObject *const_str_angle_module;
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_int_pos_2; 56 static PyObject *const_int_pos_2;
59 static PyObject *const_int_pos_4; 57 static PyObject *const_int_pos_4;
60 extern PyObject *const_str_plain___loader__; 58 extern PyObject *const_str_plain___loader__;
61 extern PyObject *const_str_plain___main__; 59 extern PyObject *const_str_plain___main__;
83     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 ); 81     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     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 102 ], 40, 0 ); 82     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 102 ], 40, 0 );
85     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 83     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
86     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 142 ], 4, 1 ); 84     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 142 ], 4, 1 );
87     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 85     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 88     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
89     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
90     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 86     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
91     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 87     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
92     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 2 ], 1, 1 ); 88     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 2 ], 1, 1 );
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[ 146 ], 3, 0 ); 90     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 146 ], 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 );
96     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 149 ], 16, 1 ); 92     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 149 ], 16, 1 );
97     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 165 ], 8, 0 ); 93     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 165 ], 8, 0 );
98     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 ); 94     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 );
n 99     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 107 ], 11, 1 ); n
100     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 ); 95     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 );
101     const_str_plain_exec = UNSTREAM_STRING( &constant_bin[ 181 ], 4, 1 ); 96     const_str_plain_exec = UNSTREAM_STRING( &constant_bin[ 181 ], 4, 1 );
102 97
103     constants_created = true; 98     constants_created = true;
104 } 99 }
126     codeobj_main = codeobj_c4375daa2ee0cb18ec34c73a610b9d20; 121     codeobj_main = codeobj_c4375daa2ee0cb18ec34c73a610b9d20;
127     codeobj_1ef0ea34862f5638a8e96fa613dba0dc = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 122     codeobj_1ef0ea34862f5638a8e96fa613dba0dc = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
128 } 123 }
129 124
130 // The module function declarations. 125 // The module function declarations.
n 131 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list( PyObject **python_pars ); n
132  
133  
134 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 126 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
135 127
136 128
137 // The module function definitions. 129 // The module function definitions.
138 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 130 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
150     PyObject *exception_keeper_type_1; 142     PyObject *exception_keeper_type_1;
151     PyObject *exception_keeper_value_1; 143     PyObject *exception_keeper_value_1;
152     PyTracebackObject *exception_keeper_tb_1; 144     PyTracebackObject *exception_keeper_tb_1;
153     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 145     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
154     PyObject *tmp_assign_source_1; 146     PyObject *tmp_assign_source_1;
n 155     PyObject *tmp_dircall_arg1_1; n
156     PyObject *tmp_dircall_arg2_1;
157     PyObject *tmp_dircall_arg3_1;
158     PyObject *tmp_frame_locals; 147     PyObject *tmp_frame_locals;
159     PyObject *tmp_return_value; 148     PyObject *tmp_return_value;
n 160     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
161     static PyFrameObject *cache_frame_function = NULL; 149     static PyFrameObject *cache_frame_function = NULL;
162 150
163     PyFrameObject *frame_function; 151     PyFrameObject *frame_function;
164 152
165     tmp_return_value = NULL; 153     tmp_return_value = NULL;
204 192
205     assert( var_args == NULL ); 193     assert( var_args == NULL );
206     Py_INCREF( tmp_assign_source_1 ); 194     Py_INCREF( tmp_assign_source_1 );
207     var_args = tmp_assign_source_1; 195     var_args = tmp_assign_source_1;
208 196
n 209     tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func ); n
210  
211     if (unlikely( tmp_dircall_arg1_1 == NULL ))
212     {
213         tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
214     }
215  
216     if ( tmp_dircall_arg1_1 == NULL )
217     {
218  
219         exception_type = PyExc_NameError;
220         Py_INCREF( exception_type );
221         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
222         exception_tb = NULL;
223         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
224         CHAIN_EXCEPTION( exception_value );
225  
226         exception_lineno = 37;
227         goto frame_exception_exit_1;
228     }
229  
230     tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
231     tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
232  
233     if (unlikely( tmp_dircall_arg3_1 == NULL ))
234     {
235         tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
236     }
237  
238     if ( tmp_dircall_arg3_1 == NULL )
239     {
240  
241         exception_type = PyExc_NameError;
242         Py_INCREF( exception_type );
243         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
244         exception_tb = NULL;
245         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
246         CHAIN_EXCEPTION( exception_value );
247  
248         exception_lineno = 37;
249         goto frame_exception_exit_1;
250     }
251  
252     Py_INCREF( tmp_dircall_arg1_1 );
253     Py_INCREF( tmp_dircall_arg2_1 );
254     Py_INCREF( tmp_dircall_arg3_1 );
255  
256     {
257         PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
258         tmp_unused = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
259     }
260     if ( tmp_unused == NULL )
261     {
262         assert( ERROR_OCCURRED() );
263  
264         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
265  
266  
267         exception_lineno = 37;
268         goto frame_exception_exit_1;
269     }
270     Py_DECREF( tmp_unused );
271 197
272 #if 0 198 #if 0
273     RESTORE_FRAME_EXCEPTION( frame_function ); 199     RESTORE_FRAME_EXCEPTION( frame_function );
274 #endif 200 #endif
275     // Put the previous frame back on top. 201     // Put the previous frame back on top.
356     exception_keeper_lineno_1 = exception_lineno; 282     exception_keeper_lineno_1 = exception_lineno;
357     exception_type = NULL; 283     exception_type = NULL;
358     exception_value = NULL; 284     exception_value = NULL;
359     exception_tb = NULL; 285     exception_tb = NULL;
360     exception_lineno = -1; 286     exception_lineno = -1;
t 361   t
362     Py_XDECREF( var_args );
363     var_args = NULL;
364 287
365     // Re-raise. 288     // Re-raise.
366     exception_type = exception_keeper_type_1; 289     exception_type = exception_keeper_type_1;
367     exception_value = exception_keeper_value_1; 290     exception_value = exception_keeper_value_1;
368     exception_tb = exception_keeper_tb_1; 291     exception_tb = exception_keeper_tb_1;