Construct CallUncompiledFunctionComplexArgs

Performance Diagrams

Construct CallUncompiledFunctionComplexArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)6275490873.61538461538461257.0CPython 2.761967046196.30769230769232260.10243178356416Nuitka (historic)61613986319.0000000000001261.4927064325575Nuitka (master)61564311441.69230769230774261.68831594139095Nuitka (develop)61564353564.3846153846155261.688150554388Nuitka (factory)Construct CallUncompiledFunctionComplexArgsTicks Construct CallUncompiledFunctionComplexArgs 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)7253297473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)65068927319.0000000000001282.42954939628305Nuitka (master)65074457441.69230769230774282.41070902615115Nuitka (develop)65064414564.3846153846155282.44492490991865Nuitka (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___main__; 58 extern PyObject *const_str_plain___main__;
61 static PyObject *const_str_angle_string; 59 static PyObject *const_str_angle_string;
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 ); 79     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     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 11 ], 40, 0 ); 80     const_str_digest_40641b58ed6f61cc974b85218932eb8d = UNSTREAM_STRING( &constant_bin[ 11 ], 40, 0 );
83     const_tuple_str_plain_args_tuple = PyTuple_New( 1 ); 81     const_tuple_str_plain_args_tuple = PyTuple_New( 1 );
84     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 51 ], 4, 1 ); 82     const_str_plain_args = UNSTREAM_STRING( &constant_bin[ 51 ], 4, 1 );
85     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); 83     PyTuple_SET_ITEM( const_tuple_str_plain_args_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args );
n 86     const_tuple_int_pos_3_tuple = PyTuple_New( 1 ); n
87     PyTuple_SET_ITEM( const_tuple_int_pos_3_tuple, 0, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
88     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 84     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
89     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 85     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
90     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 3 ], 1, 1 ); 86     const_str_plain_a = UNSTREAM_STRING( &constant_bin[ 3 ], 1, 1 );
91     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 87     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
92     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 55 ], 3, 0 ); 88     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 55 ], 3, 0 );
93     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 89     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
94     const_str_digest_e305479a9b8798c4f0176fe2073eca61 = UNSTREAM_STRING( &constant_bin[ 58 ], 91, 0 ); 90     const_str_digest_e305479a9b8798c4f0176fe2073eca61 = UNSTREAM_STRING( &constant_bin[ 58 ], 91, 0 );
95     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 149 ], 16, 1 ); 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 149 ], 16, 1 );
96     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 165 ], 8, 0 ); 92     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 165 ], 8, 0 );
97     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 83 ], 1, 1 ); 93     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 83 ], 1, 1 );
n 98     const_str_plain_python_func = UNSTREAM_STRING( &constant_bin[ 16 ], 11, 1 ); n
99     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 ); 94     const_str_angle_string = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 );
100     const_str_plain_exec = UNSTREAM_STRING( &constant_bin[ 181 ], 4, 1 ); 95     const_str_plain_exec = UNSTREAM_STRING( &constant_bin[ 181 ], 4, 1 );
101 96
102     constants_created = true; 97     constants_created = true;
103 } 98 }
125     codeobj_main = codeobj_86640aac1f7cda74c05a6c8880c6e96e; 120     codeobj_main = codeobj_86640aac1f7cda74c05a6c8880c6e96e;
126     codeobj_221e30e20a052131cd793a7472372cee = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 121     codeobj_221e30e20a052131cd793a7472372cee = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 31, const_tuple_str_plain_args_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
127 } 122 }
128 123
129 // The module function declarations. 124 // The module function declarations.
n 130 NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_1_complex_call_helper_pos_star_list( PyObject **python_pars ); n
131  
132  
133 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 125 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
134 126
135 127
136 // The module function definitions. 128 // The module function definitions.
137 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 129 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
149     PyObject *exception_keeper_type_1; 141     PyObject *exception_keeper_type_1;
150     PyObject *exception_keeper_value_1; 142     PyObject *exception_keeper_value_1;
151     PyTracebackObject *exception_keeper_tb_1; 143     PyTracebackObject *exception_keeper_tb_1;
152     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 144     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
153     PyObject *tmp_assign_source_1; 145     PyObject *tmp_assign_source_1;
n 154     PyObject *tmp_dircall_arg1_1; n
155     PyObject *tmp_dircall_arg2_1;
156     PyObject *tmp_dircall_arg3_1;
157     PyObject *tmp_return_value; 146     PyObject *tmp_return_value;
n 158     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
159     static struct Nuitka_FrameObject *cache_frame_221e30e20a052131cd793a7472372cee = NULL; 147     static struct Nuitka_FrameObject *cache_frame_221e30e20a052131cd793a7472372cee = NULL;
160 148
161     struct Nuitka_FrameObject *frame_221e30e20a052131cd793a7472372cee; 149     struct Nuitka_FrameObject *frame_221e30e20a052131cd793a7472372cee;
162 150
163     char const *type_description; 151     char const *type_description;
199 187
200     assert( var_args == NULL ); 188     assert( var_args == NULL );
201     Py_INCREF( tmp_assign_source_1 ); 189     Py_INCREF( tmp_assign_source_1 );
202     var_args = tmp_assign_source_1; 190     var_args = tmp_assign_source_1;
203 191
n 204     tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_python_func ); n
205  
206     if (unlikely( tmp_dircall_arg1_1 == NULL ))
207     {
208         tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_python_func );
209     }
210  
211     if ( tmp_dircall_arg1_1 == NULL )
212     {
213  
214         exception_type = PyExc_NameError;
215         Py_INCREF( exception_type );
216         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "python_func" );
217         exception_tb = NULL;
218         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
219         CHAIN_EXCEPTION( exception_value );
220  
221         exception_lineno = 37;
222         type_description = "o";
223         goto frame_exception_exit_1;
224     }
225  
226     tmp_dircall_arg2_1 = const_tuple_int_pos_3_tuple;
227     tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_a );
228  
229     if (unlikely( tmp_dircall_arg3_1 == NULL ))
230     {
231         tmp_dircall_arg3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_a );
232     }
233  
234     if ( tmp_dircall_arg3_1 == NULL )
235     {
236  
237         exception_type = PyExc_NameError;
238         Py_INCREF( exception_type );
239         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "a" );
240         exception_tb = NULL;
241         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
242         CHAIN_EXCEPTION( exception_value );
243  
244         exception_lineno = 37;
245         type_description = "o";
246         goto frame_exception_exit_1;
247     }
248  
249     Py_INCREF( tmp_dircall_arg1_1 );
250     Py_INCREF( tmp_dircall_arg2_1 );
251     Py_INCREF( tmp_dircall_arg3_1 );
252  
253     {
254         PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1, tmp_dircall_arg3_1};
255         tmp_unused = impl___internal__$$$function_1_complex_call_helper_pos_star_list( dir_call_args );
256     }
257     if ( tmp_unused == NULL )
258     {
259         assert( ERROR_OCCURRED() );
260  
261         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
262  
263  
264         exception_lineno = 37;
265         type_description = "o";
266         goto frame_exception_exit_1;
267     }
268     Py_DECREF( tmp_unused );
269 192
270 #if 0 193 #if 0
271     RESTORE_FRAME_EXCEPTION( frame_221e30e20a052131cd793a7472372cee ); 194     RESTORE_FRAME_EXCEPTION( frame_221e30e20a052131cd793a7472372cee );
272 #endif 195 #endif
273 196
332     exception_keeper_lineno_1 = exception_lineno; 255     exception_keeper_lineno_1 = exception_lineno;
333     exception_type = NULL; 256     exception_type = NULL;
334     exception_value = NULL; 257     exception_value = NULL;
335     exception_tb = NULL; 258     exception_tb = NULL;
336     exception_lineno = -1; 259     exception_lineno = -1;
t 337   t
338     Py_XDECREF( var_args );
339     var_args = NULL;
340 260
341     // Re-raise. 261     // Re-raise.
342     exception_type = exception_keeper_type_1; 262     exception_type = exception_keeper_type_1;
343     exception_value = exception_keeper_value_1; 263     exception_value = exception_keeper_value_1;
344     exception_tb = exception_keeper_tb_1; 264     exception_tb = exception_keeper_tb_1;