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)61514145441.69230769230774261.8858589030445Nuitka (develop)61514538564.3846153846155261.8843113532313Nuitka (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)64754470441.69230769230774283.5008850690765Nuitka (develop)64956327564.3846153846155282.81317067600185Nuitka (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
33 /* The module constants used, if any. */ 33 /* The module constants used, if any. */
34 static PyObject *const_str_plain___package__; 34 static PyObject *const_str_plain___package__;
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_dict_empty; 39 extern PyObject *const_dict_empty;
41 extern PyObject *const_str_plain___file__; 40 extern PyObject *const_str_plain___file__;
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_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__;
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 ); 80     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 );
83     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 11 ], 40, 0 ); 81     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 11 ], 40, 0 );
84     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 82     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
85     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 51 ], 4, 1 ); 83     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 51 ], 4, 1 );
86     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 84     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 87     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
88     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
89     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 85     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
90     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 86     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
91     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 3 ], 1, 1 ); 87     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 3 ], 1, 1 );
92     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 88     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
93     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 55 ], 3, 0 ); 89     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 55 ], 3, 0 );
94     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 90     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
95     const_str_digest_b9bbca022bc73c7ddd818dd2ba5bd15e = UNSTREAM_STRING( &constant_bin[ 58 ], 91, 0 ); 91     const_str_digest_b9bbca022bc73c7ddd818dd2ba5bd15e = UNSTREAM_STRING( &constant_bin[ 58 ], 91, 0 );
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[ 83 ], 1, 1 ); 94     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 83 ], 1, 1 );
n 99     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 16 ], 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_731a1bcd4f316b11dc22761e1e81bb86; 121     codeobj_main = codeobj_731a1bcd4f316b11dc22761e1e81bb86;
127     codeobj_bd0cbc8dd1129eb6f90528eb7f12b132 = 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_bd0cbc8dd1129eb6f90528eb7f12b132 = 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_return_value; 147     PyObject *tmp_return_value;
n 159     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
160     static struct Nuitka_FrameObject *cache_frame_function = NULL; 148     static struct Nuitka_FrameObject *cache_frame_function = NULL;
161 149
162     struct Nuitka_FrameObject *frame_function; 150     struct Nuitka_FrameObject *frame_function;
163 151
164     char const *type_description; 152     char const *type_description;
200 188
201     assert( var_args == NULL ); 189     assert( var_args == NULL );
202     Py_INCREF( tmp_assign_source_1 ); 190     Py_INCREF( tmp_assign_source_1 );
203     var_args = tmp_assign_source_1; 191     var_args = tmp_assign_source_1;
204 192
n 205     tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func ); n
206  
207     if (unlikely( tmp_dircall_arg1_1 == NULL ))
208     {
209         tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
210     }
211  
212     if ( tmp_dircall_arg1_1 == NULL )
213     {
214  
215         exception_type = PyExc_NameError;
216         Py_INCREF( exception_type );
217         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
218         exception_tb = NULL;
219         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
220         CHAIN_EXCEPTION( exception_value );
221  
222         exception_lineno = 37;
223         type_description = "o";
224         goto frame_exception_exit_1;
225     }
226  
227     tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
228     tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
229  
230     if (unlikely( tmp_dircall_arg3_1 == NULL ))
231     {
232         tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
233     }
234  
235     if ( tmp_dircall_arg3_1 == NULL )
236     {
237  
238         exception_type = PyExc_NameError;
239         Py_INCREF( exception_type );
240         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
241         exception_tb = NULL;
242         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
243         CHAIN_EXCEPTION( exception_value );
244  
245         exception_lineno = 37;
246         type_description = "o";
247         goto frame_exception_exit_1;
248     }
249  
250     Py_INCREF( tmp_dircall_arg1_1 );
251     Py_INCREF( tmp_dircall_arg2_1 );
252     Py_INCREF( tmp_dircall_arg3_1 );
253  
254     {
255         PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
256         tmp_unused = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
257     }
258     if ( tmp_unused == NULL )
259     {
260         assert( ERROR_OCCURRED() );
261  
262         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
263  
264  
265         exception_lineno = 37;
266         type_description = "o";
267         goto frame_exception_exit_1;
268     }
269     Py_DECREF( tmp_unused );
270 193
271 #if 0 194 #if 0
272     RESTORE_FRAME_EXCEPTION( frame_function ); 195     RESTORE_FRAME_EXCEPTION( frame_function );
273 #endif 196 #endif
274 197
333     exception_keeper_lineno_1 = exception_lineno; 256     exception_keeper_lineno_1 = exception_lineno;
334     exception_type = NULL; 257     exception_type = NULL;
335     exception_value = NULL; 258     exception_value = NULL;
336     exception_tb = NULL; 259     exception_tb = NULL;
337     exception_lineno = -1; 260     exception_lineno = -1;
t 338   t
339     Py_XDECREF( var_args );
340     var_args = NULL;
341 261
342     // Re-raise. 262     // Re-raise.
343     exception_type = exception_keeper_type_1; 263     exception_type = exception_keeper_type_1;
344     exception_value = exception_keeper_value_1; 264     exception_value = exception_keeper_value_1;
345     exception_tb = exception_keeper_tb_1; 265     exception_tb = exception_keeper_tb_1;